public class PluginContext
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
PluginContext.ControlBuilder
This interface is a builder to create new Control instances.
|
static interface |
PluginContext.TypeBuilder
This interface is a builder to create new type instances.
|
static interface |
PluginContext.Utils
This interface provides various services.
|
Modifier and Type | Method and Description |
---|---|
static <T extends PluginConfiguration> |
getConfiguration(java.lang.Class<T> configurationInterface,
PluginConfiguration pluginConfiguration)
Returns an instance of the provided configuration interface that attempts
to provide a parsed view of the raw configuration.
|
PluginContext.ControlBuilder |
getControlBuilder()
Retrieves the Control builder associated to this context.
|
PluginContext.TypeBuilder |
getTypeBuilder()
Retrieves the type builder associated to this context.
|
PluginContext.Utils |
getUtils()
Retrieves the Utils associated to this context.
|
public static <T extends PluginConfiguration> T getConfiguration(java.lang.Class<T> configurationInterface, PluginConfiguration pluginConfiguration)
The relations to the raw configuration properties are determined by reflection on the provided Java interface.
The rules are the following - the provided interface must extend the PluginConfiguration and define getters in the forms '<type> getX()' or 'boolean isY()' - the returned values are constructed from type defined in the provided configuration interface by calling thevalueOf(String)
method
(eg. String.valueOf(String))
- String getX() attempts to parse the value of the raw configuration
property defined by x=value using the String.valueOf(String) method
- if a property is multivalued then the returned type of the method defined
in the provided configuration interface must be of type
java.util.Collection
and the type contained type contained in
that collection must be defined using the annotation
ConfigurationProperty
(String is the default type).
Beware that parsing the raw configuration can throw undeclared exceptions.
T
- the type of the configuration interface that attempts to provide
the parsed configuration.configurationInterface
- the interface that defines the types and the
names of the parsed configuration properties.pluginConfiguration
- the configuration providing the raw properties.public PluginContext.Utils getUtils()
public PluginContext.TypeBuilder getTypeBuilder()
public PluginContext.ControlBuilder getControlBuilder()