Annotation Interface InjectedValue
This annotations is intended to be placed on
NamedConfigValue elements to emulate key-value pairs in configuration schemas.
Therefore, this annotation induces the following constraints:
- Must be placed on a field of a configuration schema that represents a Named List element;
- Must be the only field in the configuration schema, apart from the one marked with
InjectedName.
In all other aspects it behaves exactly like the Value annotation.
For example, this annotation can be used to declare a configuration schema with arbitrary String properties:
@Config
class PropertyConfigurationSchema {
@NamedConfigValue
public PropertyEntryConfigurationSchema properties;
}
@Config
class PropertyEntryConfigurationSchema {
@InjectedName
public String propertyName;
@InjectedValue
public String propertyValue;
}
This will allow to use the following HOCON to represent this configuration:
root.properties {
property1: "value1",
property2: "value2",
property3: "value3"
}
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanIndicates that the current configuration value has a default value.
-
Element Details
-
hasDefault
boolean hasDefaultIndicates that the current configuration value has a default value. Value itself is derived from the instantiated object of a corresponding schema type. This means that the default is not necessarily a constant value.- Returns:
hasDefaultflag value.
- Default:
- false
-