Class SpecialPropertySpecBase
- All Implemented Interfaces:
SpecialPropertySpec
,PropertySpec
- Direct Known Subclasses:
CharsetProperty
,ClockProperty
,LocaleProperty
,MessagePrefixProperty
,ProcessIdProperty
,RandomProperty
,ResourceBundleProperty
,SessionKeyProperty
,TimeZoneProperty
- Author:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: SpecialPropertySpecBase.java 1010 2022-02-05 19:28:36Z tquadrat $
- Since:
- 0.1.0
- UML Diagram
-
UML Diagram for "org.tquadrat.foundation.config.ap.impl.specialprops.SpecialPropertySpecBase"
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.tquadrat.foundation.config.ap.PropertySpec
PropertySpec.PropertyFlag
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Set
<PropertySpec.PropertyFlag> The property flags.private final SpecialPropertyType
The type of the special property. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
SpecialPropertySpecBase
(SpecialPropertyType type, PropertySpec.PropertyFlag... flags) Creates a new instance ofSpecialPropertySpecBase
. -
Method Summary
Modifier and TypeMethodDescriptionfinal Optional
<MethodSpec> createAddMethod
(CodeBuilder codeBuilder) Creates the specification of the 'add' method for this property.createConstructorFragment
(CodeBuilder codeBuilder) Creates a code block that is a fragment for the constructor of the new configuration bean and that initialises this property.createField
(CodeBuilder codeBuilder) Creates the field specification for this property.final Optional
<MethodSpec> createGetter
(CodeBuilder codeBuilder) Creates the specification of the getter for this property.final Optional
<MethodSpec> createSetter
(CodeBuilder codeBuilder) Creates the specification of the setter for this property.final Name
Returns the name of the 'add' method's argument.Returns the method that composes the 'add' method for the property.Returns the name of the 'add' method for this property.final EnumSet
<PropertySpec.PropertyFlag> Returns all the flags that were set for this special property specification.final OptionalInt
Returns the index for an argument on the command line.Returns the special CLI format.Returns the name of the CLI meta variable for this property.Returns the CLI option names.Returns the CLI usage text for this property.Returns the CLI usage key for this property.Returns the kind of collection for this property.Returns the method that composes the constructor fragment for the initialisation of the property.Returns the default value for an environment variable or a system property.Returns the name of the environment variable that is used to initialise this property.Returns the method that composes the field for the property.Returns a builder for the getter for this property.Returns the method that composes the getter for the property.Returns the name of the getter method name.Returns the return type of the getter.Returns the comment for this property in theINI
file.Returns the group for this property in theINI
file.Returns the key for this property in theINI
file.Returns thePreferences
key for this property.final String
Returns the name of the configuration property.final Name
Returns the name of the setter's argument.Returns a builder for the setter for this property.Returns the method that composes the setter for the property.Returns the name of the setter method name.final Optional
<SpecialPropertyType> Return the 'speciality' type for this property.Returns the path to the SYSTEMPreferences
node that holds the data for the initialisation of this property.Returns the name of the system property that is used to initialise this property.final boolean
Checks whether the given flag is set for this property.boolean
isEnum()
Returns the flag that indicates whether the property is anenum
type.final PropertySpec
merge()
'Merges' the attributes from a special property with the attributes retrieved from the configuration bean specification and returns a new instance ofPropertySpec
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.tquadrat.foundation.config.ap.PropertySpec
getCLIValueHandlerClass, getElementType, getFieldName, getPrefsAccessorClass, getPropertyType, getStringConverterClass, isCollection, isOnCLI
-
Field Details
-
m_PropertyFlags
The property flags. -
m_Type
The type of the special property.
-
-
Constructor Details
-
SpecialPropertySpecBase
Creates a new instance ofSpecialPropertySpecBase
.- Parameters:
type
- The type of the special property.flags
- The flags for this special property.
-
-
Method Details
-
createAddMethod
Creates the specification of the 'add' method for this property.- Specified by:
createAddMethod
in interfacePropertySpec
- Parameters:
codeBuilder
- The factory for the code generation.- Returns:
- An instance of
Optional
that holds the method specification.
-
createConstructorFragment
Creates a code block that is a fragment for the constructor of the new configuration bean and that initialises this property.- Specified by:
createConstructorFragment
in interfacePropertySpec
- Parameters:
codeBuilder
- The factory for the code generation.- Returns:
- An instance of
Optional
that holds the code block.
-
createField
Creates the field specification for this property.- Specified by:
createField
in interfacePropertySpec
- Parameters:
codeBuilder
- The factory for the code generation.- Returns:
- An instance of
Optional
that holds the field specification.
-
createGetter
Creates the specification of the getter for this property.- Specified by:
createGetter
in interfacePropertySpec
- Parameters:
codeBuilder
- The factory for the code generation.- Returns:
- An instance of
Optional
that holds the method specification.
-
createSetter
Creates the specification of the setter for this property.- Specified by:
createSetter
in interfacePropertySpec
- Parameters:
codeBuilder
- The factory for the code generation.- Returns:
- An instance of
Optional
that holds the method specification.
-
getAddMethodArgumentName
Returns the name of the 'add' method's argument.- Specified by:
getAddMethodArgumentName
in interfacePropertySpec
- Returns:
- The argument name; is probable
null
whenPropertySpec.getAddMethodName()
returnsOptional.empty()
.
-
getAddMethodComposer
@MountPoint public Optional<BiFunction<CodeBuilder,PropertySpecImpl, getAddMethodComposer()MethodSpec>> Returns the method that composes the 'add' method for the property.- Specified by:
getAddMethodComposer
in interfaceSpecialPropertySpec
- Returns:
- An instance of
Optional
that holds the 'add' method composer.
-
getAddMethodName
Returns the name of the 'add' method for this property.- Specified by:
getAddMethodName
in interfacePropertySpec
- Returns:
- An instance of
Optional
that holds the name of the add method.
-
getAllFlags
Returns all the flags that were set for this special property specification.- Specified by:
getAllFlags
in interfaceSpecialPropertySpec
- Returns:
- The flags.
-
getCLIArgumentIndex
Returns the index for an argument on the command line.
The return value will be empty if the property is not a CLI argument.
- Specified by:
getCLIArgumentIndex
in interfacePropertySpec
- Returns:
- An instance of
OptionalInt
that holds the index. - See Also:
-
getCLIFormat
Returns the special CLI format.- Specified by:
getCLIFormat
in interfacePropertySpec
- Returns:
- An instance of
Optional
that holds the format. - See Also:
-
getCLIMetaVar
Returns the name of the CLI meta variable for this property.- Specified by:
getCLIMetaVar
in interfacePropertySpec
- Returns:
- An instance of
Optional
that holds the name of the meta variable. - See Also:
-
getCLIOptionNames
Returns the CLI option names. The mandatory first name in the list is the primary name, the optional others are the aliases.
The return value will be empty if the property is not a CLI option.
- Specified by:
getCLIOptionNames
in interfacePropertySpec
- Returns:
- An instance of
Optional
that holds the option names. - See Also:
-
getCLIUsage
Returns the CLI usage text for this property. This text will not be localised.- Specified by:
getCLIUsage
in interfacePropertySpec
- Returns:
- An instance of
Optional
that holds the usage text. - See Also:
-
getCLIUsageKey
Returns the CLI usage key for this property. This key is used to retrieve a localised usage text.- Specified by:
getCLIUsageKey
in interfacePropertySpec
- Returns:
- An instance of
Optional
that holds the usage key. - See Also:
-
getCollectionKind
Returns the kind of collection for this property.- Specified by:
getCollectionKind
in interfacePropertySpec
- Returns:
- The collection kind.
-
getEnvironmentDefaultValue
Returns the default value for an environment variable or a system property. This is used to initialise this property when it has the annotation
@EnvironmentVariable
or@EnvironmentVariable
, but no value is provided.A default value is mandatory when the annotated property has a primitive type.
- Specified by:
getEnvironmentDefaultValue
in interfacePropertySpec
- Returns:
- An instance of
Optional
that holds the default value.
-
getConstructorFragmentComposer
@MountPoint public Optional<BiFunction<CodeBuilder,PropertySpecImpl, getConstructorFragmentComposer()CodeBlock>> Returns the method that composes the constructor fragment for the initialisation of the property.- Specified by:
getConstructorFragmentComposer
in interfaceSpecialPropertySpec
- Returns:
- An instance of
Optional
that holds the composer for the constructor fragment.
-
getEnvironmentVariableName
Returns the name of the environment variable that is used to initialise this property.- Specified by:
getEnvironmentVariableName
in interfacePropertySpec
- Returns:
- An instance of
Optional
that holds the environment variable name. - See Also:
-
getFieldComposer
Returns the method that composes the field for the property.- Specified by:
getFieldComposer
in interfaceSpecialPropertySpec
- Returns:
- An instance of
Optional
that holds the field composer.
-
getGetterBuilder
Returns a builder for the getter for this property.- Specified by:
getGetterBuilder
in interfacePropertySpec
- Returns:
- An instance of
Optional
that holds the builder.
-
getGetterComposer
@MountPoint public Optional<BiFunction<CodeBuilder,PropertySpecImpl, getGetterComposer()MethodSpec>> Returns the method that composes the getter for the property.- Specified by:
getGetterComposer
in interfaceSpecialPropertySpec
- Returns:
- An instance of
Optional
that holds the getter composer.
-
getGetterMethodName
Returns the name of the getter method name. If there is no name for the method, it will not be generated.- Specified by:
getGetterMethodName
in interfacePropertySpec
- Returns:
- An instance of
Optional
that holds the name of the getter method.
-
getGetterReturnType
Returns the return type of the getter. This is not necessarily the same as the property type.- Specified by:
getGetterReturnType
in interfacePropertySpec
- Returns:
- The getter's return type.
-
getINIComment
Returns the comment for this property in theINI
file.- Specified by:
getINIComment
in interfacePropertySpec
- Returns:
- An instance of
Optional
that holds the comment.
-
getINIGroup
Returns the group for this property in theINI
file.- Specified by:
getINIGroup
in interfacePropertySpec
- Returns:
- An instance of
Optional
that holds the group name.
-
getINIKey
Returns the key for this property in theINI
file.- Specified by:
getINIKey
in interfacePropertySpec
- Returns:
- An instance of
Optional
that holds the key.
-
getPrefsKey
Returns the
Preferences
key for this property.This is used when this property is linked to a preference, but also to initialise it from a SYSTEM preference. In first case, the name is defaulted to the property name, while it is mandatory otherwise.
- Specified by:
getPrefsKey
in interfacePropertySpec
- Returns:
- An instance of
Optional
that holds the preferences key for this property. - See Also:
-
getPropertyName
Returns the name of the configuration property.- Specified by:
getPropertyName
in interfacePropertySpec
- Returns:
- The name.
-
getSetterArgumentName
Returns the name of the setter's argument.- Specified by:
getSetterArgumentName
in interfacePropertySpec
- Returns:
- The argument name; is probably
null
whenPropertySpec.getSetterMethodName()
returnsOptional.empty()
.
-
getSetterBuilder
Returns a builder for the setter for this property.- Specified by:
getSetterBuilder
in interfacePropertySpec
- Returns:
- An instance of
Optional
that holds the builder.
-
getSetterComposer
@MountPoint public Optional<BiFunction<CodeBuilder,PropertySpecImpl, getSetterComposer()MethodSpec>> Returns the method that composes the setter for the property.- Specified by:
getSetterComposer
in interfaceSpecialPropertySpec
- Returns:
- An instance of
Optional
that holds the setter composer.
-
getSetterMethodName
Returns the name of the setter method name. If there is no name for the method, it will not be generated.- Specified by:
getSetterMethodName
in interfacePropertySpec
- Returns:
- An instance of
Optional
that holds the name of the setter method.
-
getSpecialPropertyType
Return the 'speciality' type for this property.- Specified by:
getSpecialPropertyType
in interfacePropertySpec
- Returns:
- An instance of
Optional
that holds the speciality type.
-
getSystemPrefsPath
Returns the path to the SYSTEMPreferences
node that holds the data for the initialisation of this property.- Specified by:
getSystemPrefsPath
in interfacePropertySpec
- Returns:
- An instance of
Optional
that holds the path. - See Also:
-
getSystemPropertyName
Returns the name of the system property that is used to initialise this property.- Specified by:
getSystemPropertyName
in interfacePropertySpec
- Returns:
- An instance of
Optional
that holds the system property name. - See Also:
-
hasFlag
Checks whether the given flag is set for this property.- Specified by:
hasFlag
in interfacePropertySpec
- Parameters:
flag
- The flag to test for.- Returns:
true
if the flag is set,false
otherwise.
-
isEnum
Returns the flag that indicates whether the property is anenum
type.- Specified by:
isEnum
in interfacePropertySpec
- Returns:
true
if the property type is anenum
,false
otherwise.
-
merge
'Merges' the attributes from a special property with the attributes retrieved from the configuration bean specification and returns a new instance of
PropertySpec
. The original instance remains unchanged.If the property is not a special property (the flag
PropertySpec.PropertyFlag.PROPERTY_IS_SPECIAL
is not set), this instance will be returned.- Specified by:
merge
in interfacePropertySpec
- Returns:
- The effective property specification.
-