Class OptionalType
- java.lang.Object
-
- software.amazon.smithy.rulesengine.language.evaluation.type.OptionalType
-
- All Implemented Interfaces:
Type
public final class OptionalType extends java.lang.Object
The "optional" type, a container for a type that may or may not be present.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
BooleanType
expectBooleanType()
OptionalType
expectOptionalType()
StringType
expectStringType()
int
hashCode()
Type
inner()
Gets the optional's contained value.boolean
isA(Type type)
Returns true if this type matches the target type.Type
provenTruthy()
When used in the context of a condition, the condition can only match if the value was truthful.java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface software.amazon.smithy.rulesengine.language.evaluation.type.Type
expectAnyType, expectArrayType, expectEmptyType, expectEndpointType, expectIntegerType, expectRecordType, expectTupleType
-
-
-
-
Method Detail
-
isA
public boolean isA(Type type)
Description copied from interface:Type
Returns true if this type matches the target type.- Parameters:
type
- the target type to match.- Returns:
- true if the types match, false otherwise.
-
provenTruthy
public Type provenTruthy()
Description copied from interface:Type
When used in the context of a condition, the condition can only match if the value was truthful. This means that a certain expression can be a different type, for example,OptionalType<T>
will becomeT
.- Returns:
- The type, given that it has been proven truthy
-
inner
public Type inner()
Gets the optional's contained value.- Returns:
- the optional's value.
-
expectStringType
public StringType expectStringType() throws InnerParseError
- Throws:
InnerParseError
-
expectBooleanType
public BooleanType expectBooleanType() throws InnerParseError
- Throws:
InnerParseError
-
expectOptionalType
public OptionalType expectOptionalType()
-
equals
public boolean equals(java.lang.Object obj)
-
hashCode
public int hashCode()
-
toString
public java.lang.String toString()
-
-