Class ModelListBuilder<T>
- java.lang.Object
-
- com.atlassian.confluence.api.model.reference.ModelListBuilder<T>
-
public class ModelListBuilder<T> extends Object
Assists in building fields that may be either a list of items or an explicit CollapsedList.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<T>
build()
Build the list.ModelListBuilder<T>
copy(Iterable<? extends T> toAdd)
Replaces any existing contents in this builder with the contents of the list.static <T> ModelListBuilder<T>
newExpandedInstance()
Create a new builder, expanded by defaultstatic <T> ModelListBuilder<T>
newInstance()
Create a new builder, collapsed by defaultModelListBuilder<T>
putAll(Iterable<? extends T> toAdd)
Add all items in the iterable to this builder.
-
-
-
Method Detail
-
newInstance
public static <T> ModelListBuilder<T> newInstance()
Create a new builder, collapsed by default
-
newExpandedInstance
public static <T> ModelListBuilder<T> newExpandedInstance()
Create a new builder, expanded by default
-
copy
public ModelListBuilder<T> copy(Iterable<? extends T> toAdd)
Replaces any existing contents in this builder with the contents of the list.If the iterable is a collapsed list, it will become the list to be returned by this builder.
Otherwise, all items from the iterable will be added to this builder, and it will be marked as expanded.
-
putAll
public ModelListBuilder<T> putAll(Iterable<? extends T> toAdd)
Add all items in the iterable to this builder.If the iterable is a collapsed list, it will become the list to be returned by this builder (which must currently be empty).
Otherwise, all items from the iterable will be added to this builder, and it will be marked as expanded.
- Returns:
- this builder
-
build
public List<T> build()
Build the list.If items have been added to the builder, or if this list was explicitly set to be expanded via
newExpandedInstance()
, an expanded list will be returned.If not, a collapsed list will be returned.
-
-