Package nz.org.riskscape.engine.typeset
Class IdentifiedType
java.lang.Object
nz.org.riskscape.engine.typeset.IdentifiedType
- All Implemented Interfaces:
Identified
,Type
,WrappingType
- Direct Known Subclasses:
CanonicalType
,LinkedType
Wraps a type to include an identifier and a TypeSet
to link it back
to some managed and identified set of types among a set.
An IdentifiedType
is equal iff the id, typeSet and subclass all match
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAttempt to convert the given value in to one represented by this type.boolean
int
estimateSize
(Object entry) Estimate the number of bytes used to serialize the given value to an output stream.getId()
abstract TypeSet
abstract Type
int
hashCode()
Class<?>
The underlying java class used to represent this type.<T extends Type>
booleanstatic Type
Strips off an outer IdentifiedType from the given type (if present)void
toBytes
(DataOutputStream os, Object toWrite) toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface nz.org.riskscape.engine.Identified
getIdentifiedClass
Methods inherited from interface nz.org.riskscape.engine.types.Type
checkForNull, find, findAllowNull, getUnwrappedType, isNumeric, isWrapped, toString, unwrap
Methods inherited from interface nz.org.riskscape.engine.types.WrappingType
asStruct, isNullable, visit
-
Constructor Details
-
IdentifiedType
-
-
Method Details
-
strip
Strips off an outer IdentifiedType from the given type (if present)
-
getUnderlyingType
- Specified by:
getUnderlyingType
in interfaceWrappingType
- Returns:
- the type that we immediately wrap. Used by
Type.getUnwrappedType()
to descend through all wrappedType
to find the first unwrapped one.
-
getTypeSet
-
coerce
Description copied from interface:Type
Attempt to convert the given value in to one represented by this type.
-
internalType
Description copied from interface:Type
The underlying java class used to represent this type.
- Specified by:
internalType
in interfaceType
-
isA
-
toString
-
equals
-
hashCode
public int hashCode() -
estimateSize
Description copied from interface:Type
Estimate the number of bytes used to serialize the given value to an output stream.
- Specified by:
estimateSize
in interfaceType
- Specified by:
estimateSize
in interfaceWrappingType
- Parameters:
entry
- the value of this type to measure. Must be ofType.internalType()
or aClassCastException
is going to happen- Returns:
- the estimated number of bytes, or zero if no estimation was possible.
-
toBytes
- Specified by:
toBytes
in interfaceType
- Specified by:
toBytes
in interfaceWrappingType
- Throws:
IOException
-
fromBytes
- Specified by:
fromBytes
in interfaceType
- Specified by:
fromBytes
in interfaceWrappingType
- Throws:
IOException
-
getId
- Specified by:
getId
in interfaceIdentified
- Returns:
- id
-