Interface PropertyVisitor

All Known Implementing Classes:
PropertyVisitorError, PropertyVisitorPrintStream, PropertyVisitorStringBase, PropertyVisitorStringBase.BiConsumerStringImpl

public interface PropertyVisitor
A property visitor is the generic interface for reading property keys and values from a PropertySet.
See Also:
PropertySet
  • Field Details

  • Method Details

    • stdout

      static PropertyVisitor stdout()
    • stderr

      static PropertyVisitor stderr()
    • of

      static PropertyVisitor of​(PrintStream out)
    • of

      static PropertyVisitor of​(BiConsumer<String,​String> consumer)
    • toStringMap

      static Map<String,​String> toStringMap​(PropertySet properties)
    • visit

      void visit​(String key, String value)
      Performs this operation on the given key and String value.
      Parameters:
      key - the key
      value - the value
    • visit

      void visit​(String key, int value)
      Performs this operation on the given key and int value.
      Parameters:
      key - the key
      value - the value
    • visit

      void visit​(String key, long value)
      Performs this operation on the given key and long value.
      Parameters:
      key - the key
      value - the value
    • visit

      void visit​(String key, boolean value)
      Performs this operation on the given key and boolean value.
      Parameters:
      key - the key
      value - the value
    • visitProperties

      default void visitProperties​(PropertySet properties)
      By default, is equivalent to properties.traverse(this). Implementations may choose to override this method, provided the property set is traversed, and this visitor receives all of the updates.
      Parameters:
      properties - the property set
    • visitProperties

      default void visitProperties​(String key, PropertySet properties)
      A helper method that recursively builds up the keys based on the provided key, and the keys of the property set. The majority of implementations should not override this.
      Parameters:
      key - the key
      properties - the property set
    • maybeVisit

      default void maybeVisit​(String key, Optional<String> value)
      A helper method that makes PropertySet.traverse(PropertyVisitor) implementations cleaner. Equivalent to value.ifPresent(x -> visit(key, x)). Must not be overridden.
      Parameters:
      key - the key
      value - the optional value
    • maybeVisit

      default void maybeVisit​(String key, OptionalInt value)
      A helper method that makes PropertySet.traverse(PropertyVisitor) implementations cleaner. Equivalent to value.ifPresent(x -> visit(key, x)). Must not be overridden.
      Parameters:
      key - the key
      value - the optional value
    • maybeVisit

      default void maybeVisit​(String key, OptionalLong value)
      A helper method that makes PropertySet.traverse(PropertyVisitor) implementations cleaner. Equivalent to value.ifPresent(x -> visit(key, x)). Must not be overridden.
      Parameters:
      key - the key
      value - the optional value
    • maybeVisitProperties

      default void maybeVisitProperties​(String key, Optional<? extends PropertySet> properties)
      A helper method that makes PropertySet.traverse(PropertyVisitor) implementations cleaner. Equivalent to properties.ifPresent(x -> visitProperties(key, x)). Must not be overridden.
      Parameters:
      key - the key
      properties - the optional value