Package io.sundr.builder
Class BaseFluent<F>
java.lang.Object
io.sundr.builder.BaseFluent<F>
- Type Parameters:
F- the fluent type
Base class that provides common functionality for fluent builders.
This class serves as a foundation for implementing fluent interfaces with visitable support.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal VisitableMapMap of visitable objects associated with this fluent instance. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> List<T>Aggregates multiple lists into a single list, filtering out null lists.static <T> Set<T>Aggregates multiple sets into a single set, filtering out null sets.static <T> List<T>Builds a list of items from a list of builders.static <T> Set<T>Builds a set of items from a set of builders.static <T> VisitableBuilder<T,?> builderOf(T item) Creates a builder for the given item.booleanGets the visitable map associated with this fluent instance.inthashCode()
-
Field Details
-
_visitables
Map of visitable objects associated with this fluent instance.
-
-
Constructor Details
-
BaseFluent
public BaseFluent()
-
-
Method Details
-
builderOf
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
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
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
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
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() -
equals
-
getVisitableMap
Gets the visitable map associated with this fluent instance.- Returns:
- an Optional containing the VisitableMap
-