Interface Prototype.OptionDecorator<B,T>

Type Parameters:
B - the type of the builder to decorate
T - the type of the option to decorate
Enclosing class:
Prototype
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface Prototype.OptionDecorator<B,T>
Provides a way to decorate a single option when it is applied to the builder. The decorator must have an accessible no argument constructor (at least package local).
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    decorate(B builder, T optionValue)
    Provides the ability to decorate option as it is being set on the target builder.
    default void
    decorateAddList(B builder, List<T> optionValues)
    Decorate a list of values, when a setter that adds values is called.
    default void
    decorateAddSet(B builder, Set<T> optionValues)
    Decorate a set of values, when a setter that adds values is called.
    default void
    decorateSetList(B builder, List<T> optionValues)
    Decorate a list of values, when a setter that replaces values is called.
    default void
    decorateSetSet(B builder, Set<T> optionValues)
    Decorate a set of values, when a setter that replaces values is called.
  • Method Details

    • decorate

      void decorate(B builder, T optionValue)
      Provides the ability to decorate option as it is being set on the target builder. This method is invoked from within the setter of the value before the value is set on the builder (i.e. the builder still contains previous value). Do not call the same setter again from within this method, as it would end in a stack overflow.
      Parameters:
      builder - the target builder being decorated
      optionValue - option value set by the caller of the setter method
    • decorateSetList

      default void decorateSetList(B builder, List<T> optionValues)
      Decorate a list of values, when a setter that replaces values is called.
      Parameters:
      builder - the target builder being decorated
      optionValues - option values set by the caller of the setter method
    • decorateAddList

      default void decorateAddList(B builder, List<T> optionValues)
      Decorate a list of values, when a setter that adds values is called.
      Parameters:
      builder - the target builder being decorated
      optionValues - option values set by the caller of the setter method
    • decorateSetSet

      default void decorateSetSet(B builder, Set<T> optionValues)
      Decorate a set of values, when a setter that replaces values is called.
      Parameters:
      builder - the target builder being decorated
      optionValues - option values set by the caller of the setter method
    • decorateAddSet

      default void decorateAddSet(B builder, Set<T> optionValues)
      Decorate a set of values, when a setter that adds values is called.
      Parameters:
      builder - the target builder being decorated
      optionValues - option values set by the caller of the setter method