| Modifier and Type | Class and Description |
|---|---|
static class |
ImmutableState.Builder<T>
Builds instances of type
ImmutableState. |
| Modifier and Type | Method and Description |
|---|---|
static <T> ImmutableState.Builder<T> |
builder(T value)
Creates a builder for
ImmutableState. |
static <T> ImmutableState<T> |
copyOf(State<T> instance)
Creates an immutable copy of a
State value. |
boolean |
equals(Object another)
This instance is equal to all instances of
ImmutableState that have equal attribute values. |
int |
hashCode()
Computes a hash code from attributes:
value, onTearDown. |
Optional<TearDown<T>> |
onTearDown() |
String |
toString()
Prints the immutable value
State with attribute values. |
T |
value() |
ImmutableState<T> |
withOnTearDown(Optional<TearDown<T>> optional)
Copy the current immutable object by setting an optional value for the
onTearDown attribute. |
ImmutableState<T> |
withOnTearDown(TearDown<T> value)
Copy the current immutable object by setting a present value for the optional
onTearDown attribute. |
ImmutableState<T> |
withValue(T value)
Copy the current immutable object by setting a value for the
value attribute. |
public T value()
public Optional<TearDown<T>> onTearDown()
onTearDown in interface State<T>onTearDown attributepublic final ImmutableState<T> withValue(T value)
value attribute.
A shallow reference equality check is used to prevent copying of the same value by returning this.value - A new value for valuethis objectpublic final ImmutableState<T> withOnTearDown(TearDown<T> value)
onTearDown attribute.value - The value for onTearDownthis objectpublic final ImmutableState<T> withOnTearDown(Optional<TearDown<T>> optional)
onTearDown attribute.
A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.optional - A value for onTearDownthis objectpublic boolean equals(Object another)
ImmutableState that have equal attribute values.public int hashCode()
value, onTearDown.public String toString()
State with attribute values.public static <T> ImmutableState<T> copyOf(State<T> instance)
State 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> ImmutableState.Builder<T> builder(T value)
ImmutableState.Copyright © 2017. All rights reserved.