@Generated(value={"Immutables.generator","NamedType<T>"}) public final class ImmutableNamedType<T> extends Object implements NamedType<T>
NamedType.
Use the builder to create immutable instances:
ImmutableNamedType.<T>builder().
Use the static factory method to create immutable instances:
ImmutableNamedType.<T>of().
| Modifier and Type | Class and Description |
|---|---|
static class |
ImmutableNamedType.Builder<T>
Builds instances of type
ImmutableNamedType. |
| Modifier and Type | Method and Description |
|---|---|
static <T> ImmutableNamedType.Builder<T> |
builder()
Creates a builder for
ImmutableNamedType. |
static <T> ImmutableNamedType<T> |
copyOf(NamedType<T> instance)
Creates an immutable copy of a
NamedType value. |
boolean |
equals(Object another)
This instance is equal to all instances of
ImmutableNamedType that have equal attribute values. |
int |
hashCode()
Computes a hash code from attributes:
name, type. |
String |
name() |
static <T> ImmutableNamedType<T> |
of(String name,
Type type)
Construct a new immutable
NamedType instance. |
String |
toString()
Prints the immutable value
NamedType with attribute values. |
Type |
type() |
ImmutableNamedType<T> |
withName(String value)
Copy the current immutable object by setting a value for the
name attribute. |
ImmutableNamedType<T> |
withType(Type value)
Copy the current immutable object by setting a value for the
type attribute. |
public String name()
public Type type()
public final ImmutableNamedType<T> withName(String value)
name attribute.
An equals check used to prevent copying of the same value by returning this.value - A new value for namethis objectpublic final ImmutableNamedType<T> withType(Type 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(Object another)
ImmutableNamedType that have equal attribute values.public int hashCode()
name, type.public String toString()
NamedType with attribute values.public static <T> ImmutableNamedType<T> of(String name, Type type)
NamedType instance.name - The value for the name attributetype - The value for the type attributepublic static <T> ImmutableNamedType<T> copyOf(NamedType<T> instance)
NamedType 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 copypublic static <T> ImmutableNamedType.Builder<T> builder()
ImmutableNamedType.T - generic parameter TCopyright © 2017. All rights reserved.