Class ImmutablePaginatedDto<PAGINATED_OBJECT>
java.lang.Object
fr.enedis.chutney.server.core.domain.tools.ImmutablePaginatedDto<PAGINATED_OBJECT>
- All Implemented Interfaces:
PaginatedDto<PAGINATED_OBJECT>
@Generated(from="PaginatedDto",
generator="Immutables")
@ParametersAreNonnullByDefault
@Generated("org.immutables.processor.ProxyProcessor")
@Immutable
@CheckReturnValue
public final class ImmutablePaginatedDto<PAGINATED_OBJECT>
extends Object
implements PaginatedDto<PAGINATED_OBJECT>
Immutable implementation of
PaginatedDto.
Use the builder to create immutable instances:
ImmutablePaginatedDto.builder().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilds instances of typeImmutablePaginatedDto. -
Method Summary
Modifier and TypeMethodDescriptionstatic <PAGINATED_OBJECT>
ImmutablePaginatedDto.Builder<PAGINATED_OBJECT> builder()Creates a builder forImmutablePaginatedDto.static <PAGINATED_OBJECT>
ImmutablePaginatedDto<PAGINATED_OBJECT> copyOf(PaginatedDto<PAGINATED_OBJECT> instance) Creates an immutable copy of aPaginatedDtovalue.data()booleanThis instance is equal to all instances ofImmutablePaginatedDtothat have equal attribute values.inthashCode()Computes a hash code from attributes:totalCount,data.toString()Prints the immutable valuePaginatedDtowith attribute values.longwithData(Iterable<? extends PAGINATED_OBJECT> elements) Copy the current immutable object with elements that replace the content ofdata.withData(PAGINATED_OBJECT... elements) Copy the current immutable object with elements that replace the content ofdata.withTotalCount(long value) Copy the current immutable object by setting a value for thetotalCountattribute.
-
Method Details
-
totalCount
public long totalCount()- Specified by:
totalCountin interfacePaginatedDto<PAGINATED_OBJECT>- Returns:
- The value of the
totalCountattribute
-
data
- Specified by:
datain interfacePaginatedDto<PAGINATED_OBJECT>- Returns:
- The value of the
dataattribute
-
withTotalCount
Copy the current immutable object by setting a value for thetotalCountattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for totalCount- Returns:
- A modified copy or the
thisobject
-
withData
@SafeVarargs public final ImmutablePaginatedDto<PAGINATED_OBJECT> withData(PAGINATED_OBJECT... elements) Copy the current immutable object with elements that replace the content ofdata.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withData
public final ImmutablePaginatedDto<PAGINATED_OBJECT> withData(Iterable<? extends PAGINATED_OBJECT> elements) Copy the current immutable object with elements that replace the content ofdata. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of data elements to set- Returns:
- A modified copy or
thisif not changed
-
equals
This instance is equal to all instances ofImmutablePaginatedDtothat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:totalCount,data. -
toString
Prints the immutable valuePaginatedDtowith attribute values. -
copyOf
public static <PAGINATED_OBJECT> ImmutablePaginatedDto<PAGINATED_OBJECT> copyOf(PaginatedDto<PAGINATED_OBJECT> instance) Creates an immutable copy of aPaginatedDtovalue. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Type Parameters:
PAGINATED_OBJECT- generic parameter PAGINATED_OBJECT- Parameters:
instance- The instance to copy- Returns:
- A copied immutable PaginatedDto instance
-
builder
Creates a builder forImmutablePaginatedDto.ImmutablePaginatedDto.<PAGINATED_OBJECT>builder() .totalCount(long) // requiredtotalCount.addData|addAllData(PAGINATED_OBJECT) //dataelements .build();- Type Parameters:
PAGINATED_OBJECT- generic parameter PAGINATED_OBJECT- Returns:
- A new ImmutablePaginatedDto builder
-