Class TypeInformation
- All Implemented Interfaces:
Identified
Meta-class for riskscape types that allows types to be plugged in to the riskscape engine. Extra information that we would be adding to the class object if Java allowed that.
-
Constructor Summary
ConstructorDescriptionTypeInformation
(String id, Class<? extends Type> typeClass, Class<?> valueType, TypeConstructor constructor) TypeInformation
(String id, Class<? extends Type> typeClass, Class<?> valueType, TypeConstructor constructor, Optional<TypeIOConstructor> typeIOConstructor) -
Method Summary
Modifier and TypeMethodDescriptionATypeConstructor
that can construct instances of this type using riskscape's type expression language.getId()
An identifier for the type - should be ([a-z]) so that it can be used to identify types with riskscape's type expression languageThe exact type that results fromTypeConstructor
will be of.An optionalTypeIOConstructor
that can return/buildTypeIO
objects for a particular type.Class<?>
The java type that is used to hold values that conform to this type.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface nz.org.riskscape.engine.Identified
getIdentifiedClass
-
Constructor Details
-
TypeInformation
public TypeInformation(String id, Class<? extends Type> typeClass, Class<?> valueType, TypeConstructor constructor) -
TypeInformation
public TypeInformation(String id, Class<? extends Type> typeClass, Class<?> valueType, TypeConstructor constructor, Optional<TypeIOConstructor> typeIOConstructor)
-
-
Method Details
-
getId
An identifier for the type - should be ([a-z]) so that it can be used to identify types with riskscape's type expression language
- Specified by:
getId
in interfaceIdentified
- Returns:
- id
-
getTypeClass
The exact type that results from
TypeConstructor
will be of. Conceptually, this is the class that we are extending/augmenting with extra meta-information. -
getValueType
The java type that is used to hold values that conform to this type. Note that multiple riskscape types might use the same java type to represent their values.
-
getConstructor
A
TypeConstructor
that can construct instances of this type using riskscape's type expression language. Note that this produces instances ofType
, not values that conform to this type. -
getTypeIOConstructor
An optional
TypeIOConstructor
that can return/buildTypeIO
objects for a particular type. For simple types, this will typically be the same instance. For complex types, it will be aTypeIO
object that works for a particular type.Not providing a
TypeIOConstructor
for aType
will potentially result inNoSuitableTypeIOException
s being thrown from engine code - all going well these will be handled and given back to the user with help on how to avoid the error.
-