Class OptionalType
- java.lang.Object
-
- software.amazon.smithy.rulesengine.language.evaluation.type.OptionalType
-
- All Implemented Interfaces:
Type
public final class OptionalType extends java.lang.ObjectThe "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 booleanequals(java.lang.Object obj)BooleanTypeexpectBooleanType()OptionalTypeexpectOptionalType()StringTypeexpectStringType()inthashCode()Typeinner()Gets the optional's contained value.booleanisA(Type type)Returns true if this type matches the target type.TypeprovenTruthy()When used in the context of a condition, the condition can only match if the value was truthful.java.lang.StringtoString()-
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:TypeReturns 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:TypeWhen 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()
-
-