Class AbstractPluginVisitor<A extends Annotation>

Type Parameters:
A - the Plugin annotation type.
All Implemented Interfaces:
Direct Known Subclasses:
PluginAttributeVisitor, PluginBuilderAttributeVisitor, PluginConfigurationVisitor, PluginElementVisitor, PluginLoggerContextVisitor, PluginNodeVisitor, PluginValueVisitor

public abstract class AbstractPluginVisitor<A extends Annotation> extends Object implements PluginVisitor<A>
Base class for PluginVisitor implementations. Provides convenience methods as well as all method implementations other than the visit method.
  • Field Details

    • LOGGER

      protected static final Logger LOGGER
      Status logger.
    • clazz

      protected final Class<A extends Annotation> clazz
    • annotation

      protected A extends Annotation annotation
    • aliases

      protected String[] aliases
    • conversionType

      protected Class<?> conversionType
    • substitutor

      protected StrSubstitutor substitutor
    • member

      protected Member member
  • Constructor Details

    • AbstractPluginVisitor

      protected AbstractPluginVisitor(Class<A> clazz)
      This constructor must be overridden by implementation classes as a no-arg constructor.
      clazz - the annotation class this PluginVisitor is for.
  • Method Details

    • setAnnotation

      public PluginVisitor<A> setAnnotation(Annotation anAnnotation)
      Description copied from interface: PluginVisitor
      Sets the Annotation to be used for this. If the given Annotation is not compatible with this class's type, then it is ignored.
      Specified by:
      setAnnotation in interface PluginVisitor<A extends Annotation>
      anAnnotation - the Annotation instance.
    • setAliases

      public PluginVisitor<A> setAliases(String... someAliases)
      Description copied from interface: PluginVisitor
      Sets the list of aliases to use for this visit. No aliases are required, however.
      Specified by:
      setAliases in interface PluginVisitor<A extends Annotation>
      someAliases - the list of aliases to use.
    • setConversionType

      public PluginVisitor<A> setConversionType(Class<?> aConversionType)
      Description copied from interface: PluginVisitor
      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.
      Specified by:
      setConversionType in interface PluginVisitor<A extends Annotation>
      aConversionType - the type to convert the plugin string to (if applicable).
    • setStrSubstitutor

      public PluginVisitor<A> setStrSubstitutor(StrSubstitutor aSubstitutor)
      Description copied from interface: PluginVisitor
      Sets the StrSubstitutor to use for converting raw strings before type conversion. Generally obtained from a Configuration.
      Specified by:
      setStrSubstitutor in interface PluginVisitor<A extends Annotation>
      aSubstitutor - the StrSubstitutor to use on plugin values.
    • setMember

      public PluginVisitor<A> setMember(Member aMember)
      Description copied from interface: PluginVisitor
      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.
      Specified by:
      setMember in interface PluginVisitor<A extends Annotation>
      aMember - the member this visitor is parsing a value for.
    • removeAttributeValue

      protected static String removeAttributeValue(Map<String,String> attributes, String name, String... aliases)
      Removes an Entry from a given Map using a key name and aliases for that key. Keys are case-insensitive.
      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.
      the value corresponding to the given key or null if nonexistent.
    • convert

      protected Object convert(String value, Object defaultValue)
      Converts the given value into the configured type falling back to the provided default value.
      value - the value to convert.
      defaultValue - the fallback value to use in case of no value or an error.
      the converted value whether that be based on the given value or the default value.