Class ImmutablePaginatedDto.Builder<PAGINATED_OBJECT>
java.lang.Object
fr.enedis.chutney.server.core.domain.tools.ImmutablePaginatedDto.Builder<PAGINATED_OBJECT>
- Enclosing class:
ImmutablePaginatedDto<PAGINATED_OBJECT>
@Generated(from="PaginatedDto",
generator="Immutables")
@NotThreadSafe
public static final class ImmutablePaginatedDto.Builder<PAGINATED_OBJECT>
extends Object
Builds instances of type
ImmutablePaginatedDto.
Initialize attributes and then invoke the build() method to create an
immutable instance.
Builder is not thread-safe and generally should not be stored in a field or collection,
but instead used immediately to create instances.
-
Method Summary
Modifier and TypeMethodDescriptionaddAllData(Iterable<? extends PAGINATED_OBJECT> elements) Adds elements todatalist.addData(PAGINATED_OBJECT element) Adds one element todatalist.addData(PAGINATED_OBJECT... elements) Adds elements todatalist.build()Builds a newImmutablePaginatedDto.data(Iterable<? extends PAGINATED_OBJECT> elements) Sets or replaces all elements fordatalist.from(PaginatedDto<PAGINATED_OBJECT> instance) Fill a builder with attribute values from the providedPaginatedDtoinstance.totalCount(long totalCount) Initializes the value for thetotalCountattribute.
-
Method Details
-
from
@CanIgnoreReturnValue public final ImmutablePaginatedDto.Builder<PAGINATED_OBJECT> from(PaginatedDto<PAGINATED_OBJECT> instance) Fill a builder with attribute values from the providedPaginatedDtoinstance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
totalCount
@CanIgnoreReturnValue public final ImmutablePaginatedDto.Builder<PAGINATED_OBJECT> totalCount(long totalCount) Initializes the value for thetotalCountattribute.- Parameters:
totalCount- The value for totalCount- Returns:
thisbuilder for use in a chained invocation
-
addData
@CanIgnoreReturnValue public final ImmutablePaginatedDto.Builder<PAGINATED_OBJECT> addData(PAGINATED_OBJECT element) Adds one element todatalist.- Parameters:
element- A data element- Returns:
thisbuilder for use in a chained invocation
-
addData
@CanIgnoreReturnValue @SafeVarargs public final ImmutablePaginatedDto.Builder<PAGINATED_OBJECT> addData(PAGINATED_OBJECT... elements) Adds elements todatalist.- Parameters:
elements- An array of data elements- Returns:
thisbuilder for use in a chained invocation
-
data
@CanIgnoreReturnValue public final ImmutablePaginatedDto.Builder<PAGINATED_OBJECT> data(Iterable<? extends PAGINATED_OBJECT> elements) Sets or replaces all elements fordatalist.- Parameters:
elements- An iterable of data elements- Returns:
thisbuilder for use in a chained invocation
-
addAllData
@CanIgnoreReturnValue public final ImmutablePaginatedDto.Builder<PAGINATED_OBJECT> addAllData(Iterable<? extends PAGINATED_OBJECT> elements) Adds elements todatalist.- Parameters:
elements- An iterable of data elements- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newImmutablePaginatedDto.- Returns:
- An immutable instance of PaginatedDto
- Throws:
IllegalStateException- if any required attributes are missing
-