A
- the Plugin annotation type.public abstract class AbstractPluginVisitor<A extends java.lang.annotation.Annotation> extends java.lang.Object implements PluginVisitor<A>
visit
method.Modifier and Type | Field and Description |
---|---|
protected java.lang.String[] |
aliases |
protected A |
annotation |
protected java.lang.Class<A> |
clazz |
protected java.lang.Class<?> |
conversionType |
protected static Logger |
LOGGER
Status logger.
|
protected java.lang.reflect.Member |
member |
protected StrSubstitutor |
substitutor |
Modifier | Constructor and Description |
---|---|
protected |
AbstractPluginVisitor(java.lang.Class<A> clazz)
This constructor must be overridden by implementation classes as a no-arg constructor.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.Object |
convert(java.lang.String value,
java.lang.Object defaultValue)
Converts the given value into the configured type falling back to the provided default value.
|
protected static java.lang.String |
removeAttributeValue(java.util.Map<java.lang.String,java.lang.String> attributes,
java.lang.String name,
java.lang.String... aliases)
Removes an Entry from a given Map using a key name and aliases for that key.
|
PluginVisitor<A> |
setAliases(java.lang.String... someAliases)
Sets the list of aliases to use for this visit.
|
PluginVisitor<A> |
setAnnotation(java.lang.annotation.Annotation anAnnotation)
Sets the Annotation to be used for this.
|
PluginVisitor<A> |
setConversionType(java.lang.Class<?> aConversionType)
Sets the class to convert the plugin value to on this visit.
|
PluginVisitor<A> |
setMember(java.lang.reflect.Member aMember)
Sets the Member that this visitor is being used for injection upon.
|
PluginVisitor<A> |
setStrSubstitutor(StrSubstitutor aSubstitutor)
Sets the StrSubstitutor to use for converting raw strings before type conversion.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
visit
protected static final Logger LOGGER
protected final java.lang.Class<A extends java.lang.annotation.Annotation> clazz
protected A extends java.lang.annotation.Annotation annotation
protected java.lang.String[] aliases
protected java.lang.Class<?> conversionType
protected StrSubstitutor substitutor
protected java.lang.reflect.Member member
protected AbstractPluginVisitor(java.lang.Class<A> clazz)
clazz
- the annotation class this PluginVisitor is for.public PluginVisitor<A> setAnnotation(java.lang.annotation.Annotation anAnnotation)
PluginVisitor
setAnnotation
in interface PluginVisitor<A extends java.lang.annotation.Annotation>
anAnnotation
- the Annotation instance.this
.public PluginVisitor<A> setAliases(java.lang.String... someAliases)
PluginVisitor
setAliases
in interface PluginVisitor<A extends java.lang.annotation.Annotation>
someAliases
- the list of aliases to use.this
.public PluginVisitor<A> setConversionType(java.lang.Class<?> aConversionType)
PluginVisitor
setConversionType
in interface PluginVisitor<A extends java.lang.annotation.Annotation>
aConversionType
- the type to convert the plugin string to (if applicable).this
.public PluginVisitor<A> setStrSubstitutor(StrSubstitutor aSubstitutor)
PluginVisitor
Configuration
.setStrSubstitutor
in interface PluginVisitor<A extends java.lang.annotation.Annotation>
aSubstitutor
- the StrSubstitutor to use on plugin values.this
.public PluginVisitor<A> setMember(java.lang.reflect.Member aMember)
PluginVisitor
setMember
in interface PluginVisitor<A extends java.lang.annotation.Annotation>
aMember
- the member this visitor is parsing a value for.this
.protected static java.lang.String removeAttributeValue(java.util.Map<java.lang.String,java.lang.String> attributes, java.lang.String name, java.lang.String... aliases)
attributes
- the Map to remove an Entry from.name
- the key name to look up.aliases
- optional aliases of the key name to look up.null
if nonexistent.protected java.lang.Object convert(java.lang.String value, java.lang.Object defaultValue)
value
- the value to convert.defaultValue
- the fallback value to use in case of no value or an error.