@Target(value=TYPE) @Retention(value=RUNTIME) @Documented public @interface ConfigurationEntries
ConfigurationData.createConfigurationObject(ConfigurationDataProvider, Class)
as well, but the presence is recommended.
The primary purpose of this annotation is that it allows factoring of
common configuration entry name prefix to a single place. If
the prefix attribute is an empty string (which is a default value),
no prefix will be used. If the prefix is set to CLASS_NAME_PREFIX,
the simple class name (without packages) will be used as a prefix.
Example of source configuration identifier - given the following interface
@ConfigurationEntries( prefix = "org.example" )
public interface TestInterface {
String textValue();
int numericValue();
@ConfigurationEntryName( name = "system.enabled" )
boolean enabled();
}
identifiers of the retrieved configuration entries will be:
| Access method | Configuration entry |
|---|---|
textValue() | org.example.textValue |
numericValue() | org.example.numericValue |
enabled() | org.example.system.enabled |
Notice that this annotation is not inherited. Even though child classes, when annotated,
will fully override the parent annotation, each configuration entry will construct its fully
qualified name based on the ConfigurationEntries annotation used on its declaring
interface.
| Modifier and Type | Fields and Description |
|---|---|
static String |
CLASS_NAME_PREFIX
When used as a
prefix() value, it is replaced at run-time by
the simple class name of the annotated interface (without package parts). |
public abstract String prefix
Copyright © 2015 Boleslav Bobcik - Auderis. All rights reserved.