Class Ip6AddressToken

java.lang.Object
com.pervasive.datarush.tokens.scalar.Ip6AddressToken
All Implemented Interfaces:
DataToken, Ip6AddressValued, ScalarToken, ScalarValued, TokenValued, ScalarTyped, TokenTyped, Serializable, Comparable<Ip6AddressToken>

public final class Ip6AddressToken extends Object implements ScalarToken, Comparable<Ip6AddressToken>
An immutable Ip6AddressValued object.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Ip6AddressToken
    A null valued Ip6AddressToken
    static final Ip6AddressToken
    A zero valued Ip6AddressToken
    static final byte[]
    The byte array representing the 0:0:0:0:0:0:0:0 ip address, the empty byte[16].
  • Constructor Summary

    Constructors
    Constructor
    Description
    Ip6AddressToken(byte[] value)
    Constructs a new token with the given non-null ip6 value.
    Constructs a new token with the ip6 address value in the given container.
    Constructs a Ip6AddressToken with the non-null ip6 address value encoded by the given string.
  • Method Summary

    Modifier and Type
    Method
    Description
    final byte[]
    Gets the contained raw IP6 address value.
    Gets the contained IP address as an Inet6Address.
    int
     
    boolean
    Indicates whether another object is equal to this token.
    Gets the data type of the token.
    int
    Returns a hash code for the token.
    final boolean
    Indicates whether the token is null valued.
    final boolean
    Indicates whether the value is the zero value for the type.
    parse(String value)
    Converts a string representation of a ip6 address value into a token.
    boolean
    represents(byte[] otherData)
    A 'deep equals' comparison of this token's contents to the provided raw ip6 bytes.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

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

    toString

    Methods inherited from interface com.pervasive.datarush.tokens.scalar.ScalarValued

    getType, isZero

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

    isNull
  • Field Details

    • NULL

      public static final Ip6AddressToken NULL
      A null valued Ip6AddressToken
    • ZERO_VALUE

      public static final byte[] ZERO_VALUE
      The byte array representing the 0:0:0:0:0:0:0:0 ip address, the empty byte[16].
    • ZERO

      public static final Ip6AddressToken ZERO
      A zero valued Ip6AddressToken
  • Constructor Details

    • Ip6AddressToken

      public Ip6AddressToken(Ip6AddressValued value)
      Constructs a new token with the ip6 address value in the given container.
      Parameters:
      value - a Ip6AddressValued containing the desired value
    • Ip6AddressToken

      public Ip6AddressToken(byte[] value)
      Constructs a new token with the given non-null ip6 value. If a null valued token is desired, use NULL.
      Parameters:
      value - the ip6 address value of the token. A copy of the array will be made.
      Throws:
      NullPointerException - if the supplied array is null
    • Ip6AddressToken

      public Ip6AddressToken(String value)
      Constructs a Ip6AddressToken with the non-null ip6 address value encoded by the given string. Should be in form 0:0:0:0:0:0:0:0 If a null valued token is desired, use NULL.
      Parameters:
      value - a string representing the ip6 value
      Throws:
      NullPointerException - if the supplied hexadecimal string is null
  • Method Details

    • compareTo

      public int compareTo(Ip6AddressToken that)
      Specified by:
      compareTo in interface Comparable<Ip6AddressToken>
    • equals

      public boolean equals(Object obj)
      Description copied from interface: DataToken
      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.
      Specified by:
      equals in interface DataToken
      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.
    • represents

      public boolean represents(byte[] otherData)
      A 'deep equals' comparison of this token's contents to the provided raw ip6 bytes. Implementations SHOULD use this instead of equals when comparing Ip4AddressTokens to arrays; equals() will eventually stop recognizing ip6 byte arrays to comply with the general equals/hashcode contracts.
      Parameters:
      otherData - the object that we're comparing to
      Returns:
      a 'deep equals' comparison of contents with otherData
    • hashCode

      public int hashCode()
      Description copied from interface: DataToken
      Returns a hash code for the token. This value is guaranteed to be consistent with that returned by TokenConverter.asHashCode(TokenValued).
      Specified by:
      hashCode in interface DataToken
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for the token
    • parse

      public static Ip6AddressToken parse(String value)
      Converts a string representation of a ip6 address value into a token. Should be in form 0:0:0:0:0:0:0:0
      Parameters:
      value - a string representing an ip6 address
      Returns:
      a token with the specified value
    • getType

      public final ScalarTokenType getType()
      Description copied from interface: TokenValued
      Gets the data type of the token. This type will dictate the valid values that can be contained.
      Specified by:
      getType in interface ScalarTyped
      Specified by:
      getType in interface ScalarValued
      Specified by:
      getType in interface TokenTyped
      Specified by:
      getType in interface TokenValued
      Returns:
      the token type.
    • asAddress

      public final byte[] asAddress()
      Description copied from interface: Ip6AddressValued
      Gets the contained raw IP6 address value.
      Specified by:
      asAddress in interface Ip6AddressValued
      Returns:
      the contained value as a byte[16]. If null valued, as indicated by TokenValued.isNull(), null is returned.
    • asInet6Address

      public final Inet6Address asInet6Address()
      Description copied from interface: Ip6AddressValued
      Gets the contained IP address as an Inet6Address.
      Specified by:
      asInet6Address in interface Ip6AddressValued
      Returns:
      the contained value as a Inet6Address. If null valued, as indicated by TokenValued.isNull(), null is returned.
    • isZero

      public final boolean isZero()
      Description copied from interface: ScalarValued
      Indicates whether the value is the zero value for the type. Zero values are not stored in sparse representation formats.
      Specified by:
      isZero in interface ScalarValued
      Returns:
      true if the value is the zero value, false otherwise.
    • toString

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

      public final boolean isNull()
      Description copied from interface: TokenValued
      Indicates whether the token is null valued. Tokens support null values analogous to SQL. Before accessing the value of the container, it is usually best to ensure it is not null valued using this method.
      Specified by:
      isNull in interface TokenValued
      Returns:
      true if the token is null valued, false otherwise