java.lang.Object
io.xpipe.core.data.type.DataType
- Direct Known Subclasses:
ArrayType,TupleType,ValueType,WildcardType
Represents the type of a
DataStructureNode object.
To check whether a DataStructureNode instance conforms to the specified type,
the method matches(DataStructureNode) can be used.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal ArrayTypeasArray()Casts this type to an array type if possible.final TupleTypeasTuple()Casts this type to a tuple type if possible.final ValueTypeasValue()Casts this type to a value type if possible.final WildcardTypeCasts this type to a wildcard type if possible.abstract Optional<DataStructureNode>convert(DataStructureNode node) Checks whether a node can be converted to this data type.abstract StringgetName()Returns the readable name of this data type that can be used for error messages.booleanisArray()Checks whether this type is an array.booleanisTuple()Checks whether this type is a tuple.booleanisValue()Checks whether this type is a value.booleanChecks whether this type is a wildcard.abstract booleanmatches(DataStructureNode node) Checks whether a node conforms to this data type.abstract voidvisit(DataTypeVisitor visitor) Visits this type using aDataTypeVisitorinstance.
-
Constructor Details
-
DataType
public DataType()
-
-
Method Details
-
getName
Returns the readable name of this data type that can be used for error messages. -
convert
Checks whether a node can be converted to this data type. -
matches
Checks whether a node conforms to this data type. -
isTuple
public boolean isTuple()Checks whether this type is a tuple. -
isWildcard
public boolean isWildcard()Checks whether this type is a wildcard. -
isArray
public boolean isArray()Checks whether this type is an array. -
isValue
public boolean isValue()Checks whether this type is a value. -
asWildcard
Casts this type to a wildcard type if possible.- Throws:
UnsupportedOperationException- if the type is not a wildcard type
-
asValue
Casts this type to a value type if possible.- Throws:
UnsupportedOperationException- if the type is not a value type
-
asTuple
Casts this type to a tuple type if possible.- Throws:
UnsupportedOperationException- if the type is not a tuple type
-
asArray
Casts this type to an array type if possible.- Throws:
UnsupportedOperationException- if the type is not an array type
-
visit
Visits this type using aDataTypeVisitorinstance.
-