Package io.dialob.api.questionnaire
Class ImmutableVariableValue
- java.lang.Object
-
- io.dialob.api.questionnaire.ImmutableVariableValue
-
- All Implemented Interfaces:
VariableValue,Serializable
@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable public final class ImmutableVariableValue extends Object implements VariableValue
Immutable implementation ofVariableValue.Use the builder to create immutable instances:
ImmutableVariableValue.builder(). Use the static factory method to create immutable instances:ImmutableVariableValue.of().- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableVariableValue.BuilderBuilds instances of typeImmutableVariableValue.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableVariableValue.Builderbuilder()Creates a builder forImmutableVariableValue.static ImmutableVariableValuecopyOf(VariableValue instance)Creates an immutable copy of aVariableValuevalue.booleanequals(Object another)This instance is equal to all instances ofImmutableVariableValuethat have equal attribute values.StringgetId()ObjectgetValue()inthashCode()Computes a hash code from attributes:id,value.static ImmutableVariableValueof(String id, Object value)Construct a new immutableVariableValueinstance.StringtoString()Prints the immutable valueVariableValuewith attribute values.ImmutableVariableValuewithId(String value)Copy the current immutable object by setting a value for theidattribute.ImmutableVariableValuewithValue(Object value)Copy the current immutable object by setting a value for thevalueattribute.
-
-
-
Method Detail
-
getId
public String getId()
- Specified by:
getIdin interfaceVariableValue- Returns:
- The value of the
idattribute
-
getValue
public Object getValue()
- Specified by:
getValuein interfaceVariableValue- Returns:
- The value of the
valueattribute
-
withId
public final ImmutableVariableValue 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- Returns:
- A modified copy of the
thisobject
-
withValue
public final ImmutableVariableValue 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 ofImmutableVariableValuethat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:id,value.
-
toString
public String toString()
Prints the immutable valueVariableValuewith attribute values.
-
of
public static ImmutableVariableValue of(String id, Object value)
Construct a new immutableVariableValueinstance.- Parameters:
id- The value for theidattributevalue- The value for thevalueattribute- Returns:
- An immutable VariableValue instance
-
copyOf
public static ImmutableVariableValue copyOf(VariableValue instance)
Creates an immutable copy of aVariableValuevalue. 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 VariableValue instance
-
builder
public static ImmutableVariableValue.Builder builder()
Creates a builder forImmutableVariableValue.ImmutableVariableValue.builder() .id(String) // requiredid.value(Object | null) // nullablevalue.build();- Returns:
- A new ImmutableVariableValue builder
-
-