Package io.dialob.rule.parser.api
Class ImmutableVariableFinder.Variable
- java.lang.Object
-
- io.dialob.rule.parser.api.ImmutableVariableFinder.Variable
-
- All Implemented Interfaces:
VariableFinder.Var,VariableFinder.Variable
- Enclosing class:
- ImmutableVariableFinder
@Immutable @CheckReturnValue public static final class ImmutableVariableFinder.Variable extends Object implements VariableFinder.Variable
Immutable implementation ofVariableFinder.Variable.Use the builder to create immutable instances:
ImmutableVariableFinder.Variable.builder().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableVariableFinder.Variable.BuilderBuilds instances of typeVariable.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableVariableFinder.Variable.Builderbuilder()Creates a builder forVariable.static ImmutableVariableFinder.VariablecopyOf(VariableFinder.Variable instance)Creates an immutable copy of aVariableFinder.Variablevalue.booleanequals(Object another)This instance is equal to all instances ofVariablethat have equal attribute values.StringgetName()Optional<Object>getPlaceHolderValue()Optional<String>getScope()Optional<String>getValueSetId()ValueTypegetValueType()inthashCode()Computes a hash code from attributes:name,valueType,scope,placeHolderValue,valueSetId.StringtoString()Prints the immutable valueVariablewith attribute values.ImmutableVariableFinder.VariablewithName(String value)Copy the current immutable object by setting a value for thenameattribute.ImmutableVariableFinder.VariablewithPlaceHolderValue(Object value)Copy the current immutable object by setting a present value for the optionalplaceHolderValueattribute.ImmutableVariableFinder.VariablewithPlaceHolderValue(Optional<? extends Object> optional)Copy the current immutable object by setting an optional value for theplaceHolderValueattribute.ImmutableVariableFinder.VariablewithScope(String value)Copy the current immutable object by setting a present value for the optionalscopeattribute.ImmutableVariableFinder.VariablewithScope(Optional<String> optional)Copy the current immutable object by setting an optional value for thescopeattribute.ImmutableVariableFinder.VariablewithValueSetId(String value)Copy the current immutable object by setting a present value for the optionalvalueSetIdattribute.ImmutableVariableFinder.VariablewithValueSetId(Optional<String> optional)Copy the current immutable object by setting an optional value for thevalueSetIdattribute.ImmutableVariableFinder.VariablewithValueType(ValueType value)Copy the current immutable object by setting a value for thevalueTypeattribute.
-
-
-
Method Detail
-
getName
public String getName()
- Specified by:
getNamein interfaceVariableFinder.Var- Returns:
- The value of the
nameattribute
-
getValueType
public ValueType getValueType()
- Specified by:
getValueTypein interfaceVariableFinder.Var- Returns:
- The value of the
valueTypeattribute
-
getScope
public Optional<String> getScope()
- Specified by:
getScopein interfaceVariableFinder.Variable- Returns:
- The value of the
scopeattribute
-
getPlaceHolderValue
public Optional<Object> getPlaceHolderValue()
- Specified by:
getPlaceHolderValuein interfaceVariableFinder.Variable- Returns:
- The value of the
placeHolderValueattribute
-
getValueSetId
public Optional<String> getValueSetId()
- Specified by:
getValueSetIdin interfaceVariableFinder.Variable- Returns:
- The value of the
valueSetIdattribute
-
withName
public final ImmutableVariableFinder.Variable withName(String value)
Copy the current immutable object by setting a value for thenameattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for name- Returns:
- A modified copy of the
thisobject
-
withValueType
public final ImmutableVariableFinder.Variable withValueType(ValueType value)
Copy the current immutable object by setting a value for thevalueTypeattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for valueType- Returns:
- A modified copy of the
thisobject
-
withScope
public final ImmutableVariableFinder.Variable withScope(String value)
Copy the current immutable object by setting a present value for the optionalscopeattribute.- Parameters:
value- The value for scope- Returns:
- A modified copy of
thisobject
-
withScope
public final ImmutableVariableFinder.Variable withScope(Optional<String> optional)
Copy the current immutable object by setting an optional value for thescopeattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for scope- Returns:
- A modified copy of
thisobject
-
withPlaceHolderValue
public final ImmutableVariableFinder.Variable withPlaceHolderValue(Object value)
Copy the current immutable object by setting a present value for the optionalplaceHolderValueattribute.- Parameters:
value- The value for placeHolderValue- Returns:
- A modified copy of
thisobject
-
withPlaceHolderValue
public final ImmutableVariableFinder.Variable withPlaceHolderValue(Optional<? extends Object> optional)
Copy the current immutable object by setting an optional value for theplaceHolderValueattribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for placeHolderValue- Returns:
- A modified copy of
thisobject
-
withValueSetId
public final ImmutableVariableFinder.Variable withValueSetId(String value)
Copy the current immutable object by setting a present value for the optionalvalueSetIdattribute.- Parameters:
value- The value for valueSetId- Returns:
- A modified copy of
thisobject
-
withValueSetId
public final ImmutableVariableFinder.Variable withValueSetId(Optional<String> optional)
Copy the current immutable object by setting an optional value for thevalueSetIdattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for valueSetId- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(@Nullable Object another)This instance is equal to all instances ofVariablethat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:name,valueType,scope,placeHolderValue,valueSetId.
-
toString
public String toString()
Prints the immutable valueVariablewith attribute values.
-
copyOf
public static ImmutableVariableFinder.Variable copyOf(VariableFinder.Variable instance)
Creates an immutable copy of aVariableFinder.Variablevalue. 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 Variable instance
-
builder
public static ImmutableVariableFinder.Variable.Builder builder()
Creates a builder forVariable.ImmutableVariableFinder.Variable.builder() .name(String) // requiredname.valueType(io.dialob.rule.parser.api.ValueType) // requiredvalueType.scope(String) // optionalscope.placeHolderValue(Object) // optionalplaceHolderValue.valueSetId(String) // optionalvalueSetId.build();- Returns:
- A new Variable builder
-
-