Class BaseFluent<F>

java.lang.Object
io.sundr.builder.BaseFluent<F>
Type Parameters:
F - the fluent type

public class BaseFluent<F> extends Object
Base class that provides common functionality for fluent builders. This class serves as a foundation for implementing fluent interfaces with visitable support.
  • Field Details

    • _visitables

      public final VisitableMap _visitables
      Map of visitable objects associated with this fluent instance.
  • Constructor Details

    • BaseFluent

      public BaseFluent()
  • Method Details

    • builderOf

      public static <T> VisitableBuilder<T,?> builderOf(T item)
      Creates a builder for the given item. First attempts to use the item's edit() method if it's Editable, otherwise tries to instantiate a corresponding Builder class.
      Type Parameters:
      T - the type of the item
      Parameters:
      item - the item to create a builder for
      Returns:
      a VisitableBuilder for the item
      Throws:
      IllegalStateException - if no builder can be created
    • build

      public static <T> List<T> build(List<? extends Builder<? extends T>> list)
      Builds a list of items from a list of builders.
      Type Parameters:
      T - the type of items to build
      Parameters:
      list - the list of builders to build from
      Returns:
      a list of built items, or null if the input list is null
    • build

      public static <T> Set<T> build(Set<? extends Builder<? extends T>> set)
      Builds a set of items from a set of builders.
      Type Parameters:
      T - the type of items to build
      Parameters:
      set - the set of builders to build from
      Returns:
      a LinkedHashSet of built items, or null if the input set is null
    • aggregate

      public static <T> List<T> aggregate(List<? extends T>... lists)
      Aggregates multiple lists into a single list, filtering out null lists.
      Type Parameters:
      T - the type of list elements
      Parameters:
      lists - the lists to aggregate
      Returns:
      a new ArrayList containing all non-null lists
    • aggregate

      public static <T> Set<T> aggregate(Set<? extends T>... sets)
      Aggregates multiple sets into a single set, filtering out null sets.
      Type Parameters:
      T - the type of set elements
      Parameters:
      sets - the sets to aggregate
      Returns:
      a new LinkedHashSet containing all non-null sets
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getVisitableMap

      public Optional<VisitableMap> getVisitableMap()
      Gets the visitable map associated with this fluent instance.
      Returns:
      an Optional containing the VisitableMap