Interface PluginVisitor<A extends Annotation>
- Type Parameters:
A
- the Annotation type.
- All Known Implementing Classes:
AbstractPluginVisitor
,PluginAttributeVisitor
,PluginBuilderAttributeVisitor
,PluginConfigurationVisitor
,PluginElementVisitor
,PluginLoggerContextVisitor
,PluginNodeVisitor
,PluginValueVisitor
public interface PluginVisitor<A extends Annotation>
Visitor strategy for parsing data from a
Node
, doing any relevant type conversion, and returning a
parsed value for that variable. Implementations must be constructable using the default constructor.-
Method Summary
Modifier and TypeMethodDescriptionsetAliases
(String... aliases) Sets the list of aliases to use for this visit.setAnnotation
(Annotation annotation) Sets the Annotation to be used for this.setConversionType
(Class<?> conversionType) Sets the class to convert the plugin value to on this visit.Sets the Member that this visitor is being used for injection upon.setStrSubstitutor
(StrSubstitutor substitutor) Sets the StrSubstitutor to use for converting raw strings before type conversion.visit
(Configuration configuration, Node node, LogEvent event, StringBuilder log) Visits a Node to obtain a value for constructing a Plugin object.
-
Method Details
-
setAnnotation
Sets the Annotation to be used for this. If the given Annotation is not compatible with this class's type, then it is ignored.- Parameters:
annotation
- the Annotation instance.- Returns:
this
.- Throws:
NullPointerException
- if the argument isnull
.
-
setAliases
Sets the list of aliases to use for this visit. No aliases are required, however.- Parameters:
aliases
- the list of aliases to use.- Returns:
this
.
-
setConversionType
Sets the class to convert the plugin value to on this visit. This should correspond with a class obtained from a factory method or builder class field. Not all PluginVisitor implementations may need this value.- Parameters:
conversionType
- the type to convert the plugin string to (if applicable).- Returns:
this
.- Throws:
NullPointerException
- if the argument isnull
.
-
setStrSubstitutor
Sets the StrSubstitutor to use for converting raw strings before type conversion. Generally obtained from aConfiguration
.- Parameters:
substitutor
- the StrSubstitutor to use on plugin values.- Returns:
this
.- Throws:
NullPointerException
- if the argument isnull
.
-
setMember
Sets the Member that this visitor is being used for injection upon. For instance, this could be the Field that is being used for injecting a value, or it could be the factory method being used to inject parameters into.- Parameters:
member
- the member this visitor is parsing a value for.- Returns:
this
.
-
visit
Visits a Node to obtain a value for constructing a Plugin object.- Parameters:
configuration
- the current Configuration.node
- the current Node corresponding to the Plugin object being created.event
- the current LogEvent that caused this Plugin object to be made (optional).log
- the StringBuilder being used to build a debug message.- Returns:
- the converted value to be used for Plugin creation.
-