Class WithinRange

java.lang.Object
nz.org.riskscape.engine.types.WithinRange
All Implemented Interfaces:
Type, WrappingType

public class WithinRange extends Object implements Type, WrappingType

Type that limits value to be within a specified range.

  • Field Details

  • Constructor Details

  • Method Details

    • coerce

      public Object coerce(Object value)
      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
    • internalType

      public Class<?> internalType()
      Description copied from interface: Type

      The underlying java class used to represent this type.

      Specified by:
      internalType in interface Type
    • toString

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

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

      public Rangeable 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.
    • getMax

      public Comparable<Object> getMax()
    • getMin

      public Comparable<Object> getMin()