Package nz.org.riskscape.engine.types
Class Bool
java.lang.Object
nz.org.riskscape.engine.types.SimpleType
nz.org.riskscape.engine.types.Bool
- All Implemented Interfaces:
TypeIO
,TypeIOConstructor
,Type
,TypeConstructor
-
Field Summary
Fields inherited from class nz.org.riskscape.engine.types.SimpleType
DEFAULT_MEMBER_NAME
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAttempt to convert the given value in to one represented by this type.int
estimateSize
(Object entry) Estimate the number of bytes used to serialize the given value to an output stream.protected String
Class<?>
The underlying java class used to represent this type.read
(ByteBuffer buffer) Read a value from the given byte buffervoid
toBytes
(DataOutputStream os, Object toWrite) void
write
(ByteBuffer buffer, Object toWrite) Write a value out to the given byte bufferMethods inherited from class nz.org.riskscape.engine.types.SimpleType
asStruct, build, construct, equals, getInstance, getTypeInformation, getTypeInformationDescription, hashCode, isSimpleType, toString, visit, writesType
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface nz.org.riskscape.engine.types.Type
asStruct, checkForNull, find, findAllowNull, getUnwrappedType, isA, isNullable, isNumeric, isWrapped, toString, unwrap, visit
Methods inherited from interface nz.org.riskscape.engine.typexp.TypeConstructor
construct
Methods inherited from interface nz.org.riskscape.engine.io.TypeIO
writesType
-
Constructor Details
-
Bool
public Bool()
-
-
Method Details
-
coerce
Description copied from interface:Type
Attempt to convert the given value in to one represented by this type.
- Specified by:
coerce
in interfaceType
- Parameters:
value
- The value to coerce- Returns:
- A value that conforms to this type
- Throws:
CoercionException
- if the given object can not be converted to something represented by this type
-
internalType
Description copied from interface:Type
The underlying java class used to represent this type.
- Specified by:
internalType
in interfaceType
-
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
- 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
- Throws:
IOException
-
fromBytes
- Specified by:
fromBytes
in interfaceType
- Throws:
IOException
-
write
Description copied from interface:TypeIO
Write a value out to the given byte buffer
-
read
Description copied from interface:TypeIO
Read a value from the given byte buffer
-
getTypeInformationId
- Overrides:
getTypeInformationId
in classSimpleType
- Returns:
- an identifier for this
SimpleType
sTypeInformation
object.
-