Class Value

java.lang.Object
nz.org.riskscape.engine.types.Value
Record Components:
type - to coerce to.

public class Value extends Object

Represents any java object that has been coerced to the associated type.

  • Constructor Details

    • Value

      public Value(Type type, Object rawValue) throws CoercionException

      Creates a new value.

      Parameters:
      type - the type that the value must conform to
      rawValue - unchecked value, that will be coerced before this object is fully created
      Throws:
      CoercionException
  • Method Details

    • of

      public static Value of(Type type, Object rawValue) throws CoercionException
      Throws:
      CoercionException
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toStruct

      public Value toStruct()
      Returns:
      If the unwrapped type of this value is not a struct, then this method will return a structed version of the value where, value is the only member of the struct
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getValue

      public Object getValue()

      The underlying value, matches getType().

    • getType

      public Type getType()

      The type that represents getValue()