Interface Type
- All Known Implementing Classes:
AnyType
,ArrayType
,BooleanType
,EmptyType
,EndpointType
,IntegerType
,OptionalType
,RecordType
,StringType
,TupleType
public interface Type
Types used to construct conditions out of values in the rules engine.
-
Method Summary
Modifier and TypeMethodDescriptionstatic AnyType
anyType()
static ArrayType
static BooleanType
static EmptyType
static EndpointType
default AnyType
default ArrayType
default BooleanType
default EmptyType
default EndpointType
default IntegerType
default OptionalType
default RecordType
expectRecordType
(String message) default StringType
default TupleType
static Type
fromParameterType
(ParameterType parameterType) static IntegerType
default boolean
Returns true if this type matches the target type.static OptionalType
optionalType
(Type type) default Type
When used in the context of a condition, the condition can only match if the value was truthful.static RecordType
recordType
(Map<Identifier, Type> inner) static StringType
static TupleType
-
Method Details
-
isA
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
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
-
fromParameterType
-
anyType
-
arrayType
-
booleanType
-
emptyType
-
endpointType
-
integerType
-
optionalType
-
recordType
-
stringType
-
tupleType
-
expectAnyType
- Throws:
InnerParseError
-
expectArrayType
- Throws:
InnerParseError
-
expectBooleanType
- Throws:
InnerParseError
-
expectEmptyType
- Throws:
InnerParseError
-
expectEndpointType
- Throws:
InnerParseError
-
expectIntegerType
- Throws:
InnerParseError
-
expectOptionalType
- Throws:
InnerParseError
-
expectRecordType
- Throws:
InnerParseError
-
expectStringType
- Throws:
InnerParseError
-
expectTupleType
- Throws:
InnerParseError
-