Package io.dialob.api.questionnaire
Class ImmutableContextValue
- java.lang.Object
-
- io.dialob.api.questionnaire.ImmutableContextValue
-
- All Implemented Interfaces:
ContextValue,Serializable
@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable public final class ImmutableContextValue extends Object implements ContextValue
Immutable implementation ofContextValue.Use the builder to create immutable instances:
ImmutableContextValue.builder(). Use the static factory method to create immutable instances:ImmutableContextValue.of().- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableContextValue.BuilderBuilds instances of typeImmutableContextValue.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableContextValue.Builderbuilder()Creates a builder forImmutableContextValue.static ImmutableContextValuecopyOf(ContextValue instance)Creates an immutable copy of aContextValuevalue.booleanequals(Object another)This instance is equal to all instances ofImmutableContextValuethat have equal attribute values.StringgetId()ObjectgetValue()inthashCode()Computes a hash code from attributes:id,value.static ImmutableContextValueof(String id, Object value)Construct a new immutableContextValueinstance.StringtoString()Prints the immutable valueContextValuewith attribute values.ImmutableContextValuewithId(String value)Copy the current immutable object by setting a value for theidattribute.ImmutableContextValuewithValue(Object value)Copy the current immutable object by setting a value for thevalueattribute.
-
-
-
Method Detail
-
getId
public String getId()
- Specified by:
getIdin interfaceContextValue- Returns:
- The value of the
idattribute
-
getValue
public Object getValue()
- Specified by:
getValuein interfaceContextValue- Returns:
- The value of the
valueattribute
-
withId
public final ImmutableContextValue withId(String value)
Copy the current immutable object by setting a value for theidattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for id (can benull)- Returns:
- A modified copy of the
thisobject
-
withValue
public final ImmutableContextValue withValue(Object value)
Copy the current immutable object by setting a value for thevalueattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for value (can benull)- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(@Nullable Object another)This instance is equal to all instances ofImmutableContextValuethat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:id,value.
-
toString
public String toString()
Prints the immutable valueContextValuewith attribute values.
-
of
public static ImmutableContextValue of(String id, Object value)
Construct a new immutableContextValueinstance.- Parameters:
id- The value for theidattributevalue- The value for thevalueattribute- Returns:
- An immutable ContextValue instance
-
copyOf
public static ImmutableContextValue copyOf(ContextValue instance)
Creates an immutable copy of aContextValuevalue. 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 ContextValue instance
-
builder
public static ImmutableContextValue.Builder builder()
Creates a builder forImmutableContextValue.ImmutableContextValue.builder() .id(String | null) // nullableid.value(Object | null) // nullablevalue.build();- Returns:
- A new ImmutableContextValue builder
-
-