Package space.arim.dazzleconf.annote
Annotation Type ConfDefault.DefaultObject
- Enclosing class:
- ConfDefault
Specifies the qualified name of the static method returning the default value.
The method must be static, and it must be visible. When the default configuration is loaded, the method will be invoked.
If the method is in the same class as the config interface this annotation is placed in, the value is this annotation is the method name (the class name can be omitted). Otherwise, the value of this annotation must be the fully qualified class name, followed by a '.', followed by the method name.
For example, @DefaultObject("com.mypackage.ConfigDefaults.someObject") will invoke the public static method called 'someObject' in the class ConfigDefaults.
Parameters
Normally, the method cannot have parameters.
The exception to this is config entries which involve a
The method must be static, and it must be visible. When the default configuration is loaded, the method will be invoked.
If the method is in the same class as the config interface this annotation is placed in, the value is this annotation is the method name (the class name can be omitted). Otherwise, the value of this annotation must be the fully qualified class name, followed by a '.', followed by the method name.
For example, @DefaultObject("com.mypackage.ConfigDefaults.someObject") will invoke the public static method called 'someObject' in the class ConfigDefaults.
Parameters
Normally, the method cannot have parameters.
The exception to this is config entries which involve a
SubSection
as a
collection element or map value. When this is the case, the method may optionally take
the sub section itself as a parameter. This allows using the default section inside the
collection or map returned by the method. In these cases, a method without any parameters
will be searched for first. If it is not found, a method with the parameter of the type of
sub section will be searched for. For example:
public interface MyConfig {
@DefaultObject("com.mypackage.MyConfigDefaults.sectionMapDefaults")
Map<String, @SubSection ConfigSection> sectionMap();
interface ConfigSection {
@DefaultInteger(3)
int someValue();
}
}
public class MyConfigDefaults {
public static Map<String, ConfigSection> sectionMapDefaults(ConfigSection defaultConfigSection) {
return Map.of("key-one", defaultConfigSection);
}
}
-
Required Element Summary
-
Element Details
-
value
String value
-