Package fr.enedis.chutney.dataset.api
Class ImmutableKeyValue
java.lang.Object
fr.enedis.chutney.dataset.api.ImmutableKeyValue
- All Implemented Interfaces:
KeyValue
@Generated(from="KeyValue",
generator="Immutables")
@ParametersAreNonnullByDefault
@Generated("org.immutables.processor.ProxyProcessor")
@Immutable
@CheckReturnValue
public final class ImmutableKeyValue
extends Object
implements KeyValue
Immutable implementation of
KeyValue.
Use the builder to create immutable instances:
ImmutableKeyValue.builder().
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableKeyValue.Builderbuilder()Creates a builder forImmutableKeyValue.static ImmutableKeyValueCreates an immutable copy of aKeyValuevalue.booleanThis instance is equal to all instances ofImmutableKeyValuethat have equal attribute values.inthashCode()Computes a hash code from attributes:key,value.key()toString()Prints the immutable valueKeyValuewith attribute values.value()final ImmutableKeyValueCopy the current immutable object by setting a value for thekeyattribute.final ImmutableKeyValueCopy the current immutable object by setting a value for thevalueattribute.
-
Method Details
-
key
-
value
-
withKey
Copy the current immutable object by setting a value for thekeyattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for key- Returns:
- A modified copy or the
thisobject
-
withValue
Copy the current immutable object by setting a value for thevalueattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for value- Returns:
- A modified copy or the
thisobject
-
equals
This instance is equal to all instances ofImmutableKeyValuethat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:key,value. -
toString
Prints the immutable valueKeyValuewith attribute values. -
copyOf
Creates an immutable copy of aKeyValuevalue. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance- The instance to copy- Returns:
- A copied immutable KeyValue instance
-
builder
Creates a builder forImmutableKeyValue.ImmutableKeyValue.builder() .key(String) // requiredkey.value(String) // optionalvalue.build();- Returns:
- A new ImmutableKeyValue builder
-