Package net.obvj.confectory.util
Annotation Type Property
-
@Retention(RUNTIME) @Target(FIELD) public @interface Property
Marker annotation that can be used to indicate that an object field shall be associated with the property key defined by the annotation value.Here is an example of how this annotation is meant to be used:
public class MyClass { @Property("host") String myHost; @Property("port") int myPort; ... }NOTE: The default value (
"") indicates that the field name will be used as the property key.- Since:
- 1.2.0
- Author:
- oswaldo.bapvic.jr
- See Also:
PropertiesToObjectMapper
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description Class<? extends TypeConverter<?>>[]converterAn optionalTypeConverterto convert this property value into a strongly typed object.StringkeyDefines the property key from the source file/URL to be associated with this field.StringvalueDefines the property key from the source file/URL to be associated with this field.
-
-
-
Element Detail
-
value
String value
Defines the property key from the source file/URL to be associated with this field.NOTE: The name "
value" is used here to allow the following notation:
which is supposed to have the same effect of the following (when no other attribute is present):@Property("host")@Property(key = "host")
- Returns:
- the key from the source file/URL to be associated with the annotated field
- Default:
- ""
-
-
-
key
String key
Defines the property key from the source file/URL to be associated with this field.This is recommended when the class field name differs from the actual property key and other attributes (such as the converter) are present in the annotation.
For example:
@Property(key = "theKey", converter = MyConverter.class)
- Returns:
- the key from the source file/URL to be associated with the annotated field
- Since:
- 2.5.0
- Default:
- ""
-
-
-
converter
Class<? extends TypeConverter<?>>[] converter
An optionalTypeConverterto convert this property value into a strongly typed object.This is useful when a particular field should use a custom conversion that is different from the normal conversion for the field's type (which is applied by the
TypeFactory).Examples:
@Property(converter = MyConverter.class) @Property(key = "theKey", converter = MyConverter.class)
- Returns:
- the class to convert String value into a strongly-typed object for the annotated field
- Since:
- 2.5.0
- Default:
- {}
-
-