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 Details

    • setAnnotation

      PluginVisitor<A> setAnnotation(Annotation annotation)
      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 is null.
    • setAliases

      PluginVisitor<A> setAliases(String... aliases)
      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

      PluginVisitor<A> setConversionType(Class<?> conversionType)
      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 is null.
    • setStrSubstitutor

      PluginVisitor<A> setStrSubstitutor(StrSubstitutor substitutor)
      Sets the StrSubstitutor to use for converting raw strings before type conversion. Generally obtained from a Configuration.
      Parameters:
      substitutor - the StrSubstitutor to use on plugin values.
      Returns:
      this.
      Throws:
      NullPointerException - if the argument is null.
    • setMember

      PluginVisitor<A> setMember(Member member)
      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

      Object visit(Configuration configuration, Node node, LogEvent event, StringBuilder log)
      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.