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
FieldsModifier and TypeFieldDescriptionstatic final Ip6AddressTokenA null valuedIp6AddressTokenstatic final Ip6AddressTokenA zero valuedIp6AddressTokenstatic final byte[]The byte array representing the 0:0:0:0:0:0:0:0 ip address, the emptybyte[16]. -
Constructor Summary
ConstructorsConstructorDescriptionIp6AddressToken(byte[] value) Constructs a new token with the given non-null ip6 value.Ip6AddressToken(Ip6AddressValued value) Constructs a new token with the ip6 address value in the given container.Ip6AddressToken(String value) Constructs aIp6AddressTokenwith the non-null ip6 address value encoded by the given string. -
Method Summary
Modifier and TypeMethodDescriptionfinal byte[]Gets the contained raw IP6 address value.final Inet6AddressGets the contained IP address as an Inet6Address.intcompareTo(Ip6AddressToken that) booleanIndicates whether another object is equal to this token.final ScalarTokenTypegetType()Gets the data type of the token.inthashCode()Returns a hash code for the token.final booleanisNull()Indicates whether the token is null valued.final booleanisZero()Indicates whether the value is the zero value for the type.static Ip6AddressTokenConverts a string representation of a ip6 address value into a token.booleanrepresents(byte[] otherData) A 'deep equals' comparison of this token's contents to the provided raw ip6 bytes.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.pervasive.datarush.tokens.scalar.ScalarValued
getType, isZeroMethods inherited from interface com.pervasive.datarush.tokens.TokenValued
isNull
-
Field Details
-
NULL
A null valuedIp6AddressToken -
ZERO_VALUE
public static final byte[] ZERO_VALUEThe byte array representing the 0:0:0:0:0:0:0:0 ip address, the emptybyte[16]. -
ZERO
A zero valuedIp6AddressToken
-
-
Constructor Details
-
Ip6AddressToken
Constructs a new token with the ip6 address value in the given container.- Parameters:
value- aIp6AddressValuedcontaining 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, useNULL.- Parameters:
value- the ip6 address value of the token. A copy of the array will be made.- Throws:
NullPointerException- if the supplied array isnull
-
Ip6AddressToken
Constructs aIp6AddressTokenwith 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, useNULL.- Parameters:
value- a string representing the ip6 value- Throws:
NullPointerException- if the supplied hexadecimal string isnull
-
-
Method Details
-
compareTo
- Specified by:
compareToin interfaceComparable<Ip6AddressToken>
-
equals
Description copied from interface:DataTokenIndicates whether another object is equal to this token. Two null valued tokens are considered equal. This differs from the behavior ofTokenComparator.equal(TokenValued,TokenValued)but makes it possible to storeDataTokens inMaps. -
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:DataTokenReturns a hash code for the token. This value is guaranteed to be consistent with that returned byTokenConverter.asHashCode(TokenValued). -
parse
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
Description copied from interface:TokenValuedGets the data type of the token. This type will dictate the valid values that can be contained.- Specified by:
getTypein interfaceScalarTyped- Specified by:
getTypein interfaceScalarValued- Specified by:
getTypein interfaceTokenTyped- Specified by:
getTypein interfaceTokenValued- Returns:
- the token type.
-
asAddress
public final byte[] asAddress()Description copied from interface:Ip6AddressValuedGets the contained raw IP6 address value.- Specified by:
asAddressin interfaceIp6AddressValued- Returns:
- the contained value as a
byte[16]. If null valued, as indicated byTokenValued.isNull(),nullis returned.
-
asInet6Address
Description copied from interface:Ip6AddressValuedGets the contained IP address as an Inet6Address.- Specified by:
asInet6Addressin interfaceIp6AddressValued- Returns:
- the contained value as a
Inet6Address. If null valued, as indicated byTokenValued.isNull(),nullis returned.
-
isZero
public final boolean isZero()Description copied from interface:ScalarValuedIndicates whether the value is the zero value for the type. Zero values are not stored in sparse representation formats.- Specified by:
isZeroin interfaceScalarValued- Returns:
trueif the value is the zero value,falseotherwise.
-
toString
-
isNull
public final boolean isNull()Description copied from interface:TokenValuedIndicates 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:
isNullin interfaceTokenValued- Returns:
trueif the token is null valued,falseotherwise
-