Class GeomType

java.lang.Object
nz.org.riskscape.engine.types.SimpleType
nz.org.riskscape.engine.types.GeomType
All Implemented Interfaces:
TypeIO, TypeIOConstructor, Type, WrappingType, TypeConstructor
Direct Known Subclasses:
GeomType.Line, GeomType.Point, GeomType.Polygon

public abstract class GeomType extends SimpleType implements WrappingType

Base for a Type that wraps Types.GEOMETRY to make it a more specific geometry sub-type.

  • Constructor Details

    • GeomType

      public GeomType()
  • Method Details

    • isAllowNull

      public static boolean isAllowNull(Type toCheck)
      Returns:
      true if toCheck is assignable to geometry, false otherwise
    • getUnderlyingType

      public Type getUnderlyingType()
      Specified by:
      getUnderlyingType in interface WrappingType
      Returns:
      the type that we immediately wrap. Used by Type.getUnwrappedType() to descend through all wrapped Type to find the first unwrapped one.
    • coerce

      public Object coerce(Object value) throws CoercionException
      Description copied from interface: Type

      Attempt to convert the given value in to one represented by this type.

      Specified by:
      coerce in interface Type
      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
    • write

      public void write(ByteBuffer buffer, Object value)
      Description copied from interface: TypeIO

      Write a value out to the given byte buffer

      Specified by:
      write in interface TypeIO
    • read

      public Object read(ByteBuffer buffer)
      Description copied from interface: TypeIO

      Read a value from the given byte buffer

      Specified by:
      read in interface TypeIO
    • isA

      public <T extends Type> boolean isA(Class<T> type)
      Specified by:
      isA in interface Type
    • visit

      public <T, U> U visit(TypeVisitor<T,U> tv, T data)
      Description copied from interface: Type

      Type specific visiting logic. Types must decide whether they are atomic or compound and call the relevant method on TypeVisitor. It's up to each compound type to decide how they want to structure their children, e.g. order, metadata, and what's considered a child or not.

      Specified by:
      visit in interface Type
      Specified by:
      visit in interface WrappingType
      Overrides:
      visit in class SimpleType