Interface TokenConverter


public interface TokenConverter
An object capable of converting tokens into other formats. While the interface is generically typed, using TokenValued, implementations are generally type specific, working on only tokens of one type.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Computes a hash code for the source token value.
    Creates an Object representation of the source value.
    Creates a string representation of the source value, suitable for displaying to users.
    Creates an immutable copy of the source value.
    void
    Sets the source value for this converter.
  • Method Details

    • setSource

      void setSource(TokenValued value)
      Sets the source value for this converter.
      Parameters:
      value - the source of values to be converted
    • asToken

      DataToken asToken()
      Creates an immutable copy of the source value.
      Returns:
      an immutable token holding the same token value
    • asObject

      Object asObject()
      Creates an Object representation of the source value. The type of the object returned depends on the token type.

      Token TypeObject Type
      BINARYbyte array
      BOOLEANBoolean
      CHARCharacter
      DATEDate (time portion will be midnight)
      DOUBLEDouble
      ENUMString
      FLOATFloat
      INTInteger
      IP4ADDRESSInet4Address
      IP6ADDRESSInet6Address
      LONGLong
      NUMERICBigDecimal
      OBJECTObject
      RECORDMap
      STRINGString
      TIMESTAMPDate (date portion will by January 1, 1970)
      TIMESTAMPTimestamp

      A null object reference is returned if the current token value is null.

      Returns:
      an Object containing the current token value
    • asString

      String asString()
      Creates a string representation of the source value, suitable for displaying to users.
      Returns:
      the formatted value
    • asHashCode

      int asHashCode()
      Computes a hash code for the source token value. Two token values reported equal by TokenComparator.equal() will always generate the same hash code.
      Returns:
      a computed hash code for the value