Class TypeInformation

java.lang.Object
nz.org.riskscape.engine.types.TypeInformation
All Implemented Interfaces:
Identified

public class TypeInformation extends Object implements 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 Details

  • Method Details

    • getId

      public String 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 interface Identified
      Returns:
      id
    • getTypeClass

      public Class<? extends Type> 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

      public Class<?> 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

      public TypeConstructor getConstructor()

      A TypeConstructor that can construct instances of this type using riskscape's type expression language. Note that this produces instances of Type, not values that conform to this type.

    • getTypeIOConstructor

      public Optional<TypeIOConstructor> getTypeIOConstructor()

      An optional TypeIOConstructor that can return/build TypeIO objects for a particular type. For simple types, this will typically be the same instance. For complex types, it will be a TypeIO object that works for a particular type.

      Not providing a TypeIOConstructor for a Type will potentially result in NoSuitableTypeIOExceptions 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.