Platform SDK Java 8.5 API Reference

com.genesyslab.platform.commons.collections
Class Pair

java.lang.Object
  extended by com.genesyslab.platform.commons.collections.Pair
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
KeyValuePair

public abstract class Pair
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

This class represents the pair in key-value list. You will rarely need to create the Pair explicitly. Use appropriate add method of the list.

See Also:
Serialized Form

Field Summary
protected  java.lang.Object key
          Key of the Pair
protected  java.lang.Object value
          Value of the pair
 
Constructor Summary
Pair()
           
 
Method Summary
protected  java.lang.Object clone()
           
 boolean equals(java.lang.Object obj)
           
 byte[] getBinaryValue()
          Returns binary value of the Pair or null if the value is not a binary data.
 java.lang.Integer getIntValue()
          Returns integer value.
 java.lang.String getStringKey()
          Returns the key as a string.
 java.lang.String getStringValue()
          Returns string value of the Pair or null if the value is not a string.
 java.lang.Object getValue()
           
 ValueType getValueType()
          Returns the type of value that is stored in this Pair.
 int hashCode()
           
 void setBinaryValue(byte[] data)
          Sets value of this Pair to some binary data
 void setIntValue(int i)
          Sets value of this Pair to an integer.
 void setIntValue(java.lang.Integer i)
          Sets value of this Pair to an integer.
 void setStringValue(java.lang.String val)
          Sets value of this Pair to a string.
 void setUTF16Value(java.lang.String val)
          Sets value of this Pair to UTF-16 String.
 void setUTF16Value(UTFValue val)
          Sets value of this Pair to UTF-16 String.
protected  void setValue(java.lang.Object val)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

key

protected java.lang.Object key
Key of the Pair


value

protected java.lang.Object value
Value of the pair

Constructor Detail

Pair

public Pair()
Method Detail

getStringKey

public java.lang.String getStringKey()
Returns the key as a string.

Returns:
String value of the key or null if key is not a String

getIntValue

public java.lang.Integer getIntValue()
Returns integer value.

Returns:
value of this Pair or null if value is not an integer

setIntValue

public void setIntValue(int i)
Sets value of this Pair to an integer.

Parameters:
i - new value (integer)

setIntValue

public void setIntValue(java.lang.Integer i)
Sets value of this Pair to an integer.

Parameters:
i - new value (integer)

getBinaryValue

public byte[] getBinaryValue()
Returns binary value of the Pair or null if the value is not a binary data.

Returns:
Binary data or null

getValue

public java.lang.Object getValue()

setBinaryValue

public void setBinaryValue(byte[] data)
Sets value of this Pair to some binary data

Parameters:
data - new value (binary data)
Throws:
java.lang.NullPointerException - if data is null

getStringValue

public java.lang.String getStringValue()
Returns string value of the Pair or null if the value is not a string.

Returns:
String or null

setStringValue

public void setStringValue(java.lang.String val)
Sets value of this Pair to a string.

Parameters:
val - new value (String)
Throws:
java.lang.NullPointerException - if val is null

setUTF16Value

public void setUTF16Value(java.lang.String val)
Sets value of this Pair to UTF-16 String. To retrieve such value use getStringValue() method.
Getting this value with getValue() returns special string wrapper instance (UTFValue).
It will have special value type - getValueType() will return ValueType.WIDE_STRING.
The value set with this method will be serialized differently than the value set with setStringValue(String).

Parameters:
val - string value
Throws:
java.lang.NullPointerException - if val is null
See Also:
UTFValue

setUTF16Value

public void setUTF16Value(UTFValue val)
Sets value of this Pair to UTF-16 String. To retrieve such value use getStringValue() method.
Getting this value with getValue() returns special string wrapper instance (UTFValue).
It will have special value type - getValueType() will return ValueType.WIDE_STRING.
The value set with this method will be serialized differently than the value set with setStringValue(String).

Parameters:
val - UTF-string value
Throws:
java.lang.NullPointerException - if val is null
See Also:
UTFValue

getValueType

public ValueType getValueType()
Returns the type of value that is stored in this Pair. For supported types please consult documentation of the List you use.

Returns:
Type of the value for this Pair.

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

clone

protected java.lang.Object clone()
                          throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

setValue

protected void setValue(java.lang.Object val)

Platform SDK Java 8.5 API Reference

Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.