Interface DataToken

All Superinterfaces:
Serializable, TokenTyped, TokenValued
All Known Subinterfaces:
ScalarToken
All Known Implementing Classes:
BinaryToken, BooleanToken, CharToken, DateToken, DoubleToken, DurationToken, FloatToken, IntToken, Ip4AddressToken, Ip6AddressToken, LongToken, MoneyToken, NullToken, NumericToken, ObjectToken, PeriodToken, RecordToken, StringToken, TimestampToken, TimeToken

public interface DataToken extends TokenValued, Serializable
An immutable TokenValued object. In addition to adding immutability to the TokenValued contract, implementations of DataToken also implement a number of useful features:
  • a type-appropriate Comparable interface
  • an overrides of Object.hashCode() consistent with the values returned by TokenConverter.
  • an override of Object.equals() which considers null valued tokens equal, as opposed to to different (as in TokenComparator).
These properties make DataTokens a useful mechanism for general in-memory storage of token values.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Indicates whether another object is equal to this token.
    int
    Returns a hash code for the token.
    Returns a string representation of the token's value.

    Methods inherited from interface com.pervasive.datarush.tokens.TokenValued

    getType, isNull
  • Method Details

    • equals

      boolean equals(Object obj)
      Indicates whether another object is equal to this token. Two null valued tokens are considered equal. This differs from the behavior of TokenComparator.equal(TokenValued,TokenValued) but makes it possible to store DataTokens in Maps.
      Overrides:
      equals in class Object
      Parameters:
      obj - the object to compare
      Returns:
      true if the other object is a token of the same type and contains the same value, false otherwise.
    • hashCode

      int hashCode()
      Returns a hash code for the token. This value is guaranteed to be consistent with that returned by TokenConverter.asHashCode(TokenValued).
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for the token
    • toString

      String toString()
      Returns a string representation of the token's value. This value is guaranteed to be consistent with that returned by TokenConverter.asString(TokenValued}.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the contained value