@ParametersAreNonnullByDefault @Generated(value="org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableNamed<T> extends Named<T>
Named.
Use the static factory method to create immutable instances:
ImmutableNamed.of().
| Modifier and Type | Method and Description |
|---|---|
String |
asHumanReadable()
Returns a lazily initialized value of the
asHumanReadable attribute. |
static <T> ImmutableNamed<T> |
copyOf(Named<T> instance)
Creates an immutable copy of a
Named value. |
boolean |
equals(Object another)
This instance is equal to all instances of
ImmutableNamed that have equal attribute values. |
int |
hashCode()
Computes a hash code from attributes:
name, type. |
protected Optional<String> |
name() |
static <T> ImmutableNamed<T> |
of(Optional<String> name,
Class<T> type)
Construct a new immutable
Named instance. |
String |
toString()
Prints the immutable value
Named with attribute values. |
protected Class<T> |
type() |
ImmutableNamed<T> |
withName(Optional<String> optional)
Copy the current immutable object by setting an optional value for the
name attribute. |
ImmutableNamed<T> |
withName(String value)
Copy the current immutable object by setting a present value for the optional
name attribute. |
ImmutableNamed<T> |
withType(Class<T> value)
Copy the current immutable object by setting a value for the
type attribute. |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitrelatedTo, unvalidatedasHumanReadablepublic final ImmutableNamed<T> withName(String value)
name attribute.value - The value for namethis objectpublic final ImmutableNamed<T> withName(Optional<String> optional)
name attribute.
An equality check is used on inner nullable value to prevent copying of the same value by returning this.optional - A value for namethis objectpublic final ImmutableNamed<T> withType(Class<T> value)
type attribute.
A shallow reference equality check is used to prevent copying of the same value by returning this.value - A new value for typethis objectpublic boolean equals(@Nullable Object another)
ImmutableNamed that have equal attribute values.public int hashCode()
name, type.public String toString()
Named with attribute values.public String asHumanReadable()
Returns a lazily initialized value of the asHumanReadable attribute.
Initialized once and only once and stored for subsequent access with proper synchronization.
In case of any exception or error thrown by the lazy value initializer,
the result will not be memoised (i.e. remembered) and on next call computation
will be attempted again.
asHumanReadable in interface HasHumanReadableLabelasHumanReadable in class Named<T>asHumanReadable attributepublic static <T> ImmutableNamed<T> of(Optional<String> name, Class<T> type)
Named instance.T - generic parameter Tname - The value for the name attributetype - The value for the type attributepublic static <T> ImmutableNamed<T> copyOf(Named<T> instance)
Named value.
Uses accessors to get values to initialize the new immutable instance.
If an instance is already immutable, it is returned as is.T - generic parameter Tinstance - The instance to copyCopyright © 2023. All rights reserved.