Configuration Platform SDK 7.6 API Reference

com.genesyslab.platform.commons.collections
Class KVList

java.lang.Object
  extended bycom.genesyslab.platform.commons.collections.KVList
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.io.Serializable
Direct Known Subclasses:
KeyValueCollection

public abstract class KVList
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable, java.util.Collection

Key-value list. Ordered collection of key-value pairs. Nulls are not accepted neither as a key nor as a value.

Keys are not required to be unique and getters will return first encountered value for the key. Use getEnumeration(String) if you need all pairs with the given key.

KVList implements Collection interface. The elements of the Collection are Pairs.

See Also:
Serialized Form

Nested Class Summary
static interface KVList.PairList
          A list of key-value pairs.
 
Constructor Summary
KVList()
           
 
Method Summary
 boolean add(java.lang.Object o)
           
 boolean addAll(java.util.Collection c)
           
 void addBinary(java.lang.String key, byte[] data)
          Add binary value to the list with specified key
 void addInt(java.lang.String key, int value)
          Add integer value to the list with specified key
 void addInt(java.lang.String key, java.lang.Integer value)
          Add integer value to the list with specified key
 void addObject(java.lang.String key, java.lang.Object value)
          Add supported value to this list with specified key.
 void addString(java.lang.String key, java.lang.String value)
          Add string value to the list with specified key.
 void addUTFString(java.lang.String key, java.lang.String value)
          Add string value to the list with specified key.
 void clear()
          Clear the list.
 java.lang.Object clone()
           
 boolean contains(java.lang.Object o)
           
 boolean containsAll(java.util.Collection c)
           
 boolean containsKey(java.lang.Object key)
           
 boolean equals(java.lang.Object obj)
           
 byte[] getBinary(java.lang.String key)
          Return binary data stored with specified key.
 java.util.Enumeration getEnumeration()
          Returns an Enumeration through this list.
 java.util.Enumeration getEnumeration(java.lang.String key)
          Returns an Enumeration of pairs with specified key from this list.
 java.lang.Integer getInt(java.lang.String key)
          Return integer value stored with specified key.
 java.lang.String getString(java.lang.String key)
          Return string value stored with specified key.
 boolean isEmpty()
          Checks if the list is empty (doesn't contain any pair)
 java.util.Iterator iterator()
           
 int length()
          Returns length of this list (number of pairs)
 boolean remove(java.lang.Object o)
           
 boolean removeAll(java.util.Collection c)
           
 boolean retainAll(java.util.Collection c)
           
 int size()
           
 java.lang.Object[] toArray()
           
 java.lang.Object[] toArray(java.lang.Object[] a)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
hashCode
 

Constructor Detail

KVList

public KVList()
Method Detail

addBinary

public void addBinary(java.lang.String key,
                      byte[] data)
Add binary value to the list with specified key

Parameters:
key - key of the added pair
data - binary data

addInt

public void addInt(java.lang.String key,
                   int value)
Add integer value to the list with specified key

Parameters:
key - key of the added pair
value - integer value

addInt

public void addInt(java.lang.String key,
                   java.lang.Integer value)
Add integer value to the list with specified key

Parameters:
key - key of the added pair
value - integer value

addString

public void addString(java.lang.String key,
                      java.lang.String value)
Add string value to the list with specified key. During serialization process this string will be represented in single byte encoding (using platform default one). If you use national symbols in the value, please consider using addUTFString(String, String) method.

Parameters:
key - key of the added pair
value - String value

addUTFString

public void addUTFString(java.lang.String key,
                         java.lang.String value)
Add string value to the list with specified key. During serialization process this string will be represented by two bytes encoding (UTF16-BE)

Parameters:
key - key of the added pair
value - String value

addObject

public void addObject(java.lang.String key,
                      java.lang.Object value)
               throws java.lang.IllegalArgumentException
Add supported value to this list with specified key. Please note, that list does not support arbitrary values, there is limited amount of supported types. This method will throw exception if value is of unsupported type. Also, string values will be added as ordinary (one byte per simbol) string. If you need to use national symbols use addUTFString(String, String).

Parameters:
key - key of the added pair
value - value
Throws:
java.lang.IllegalArgumentException - if value has unsupported type

getBinary

public byte[] getBinary(java.lang.String key)
Return binary data stored with specified key. If no such key in list or data is not binary (has some other type) null is returned.

Parameters:
key - key of the binary value
Returns:
binary data or null if key not found or value has some other type

getInt

public java.lang.Integer getInt(java.lang.String key)
Return integer value stored with specified key. If no such key in list or data is not integer (has some other type) 0 (zero) is returned.

Parameters:
key - key of the integer value
Returns:
integer value or null if key not found or value has some other type

getString

public java.lang.String getString(java.lang.String key)
Return string value stored with specified key. If no such key in list or data is not string (has some other type) null is returned.

Parameters:
key - key of the value
Returns:
string value or null if key not found or value has some other type

clear

public void clear()
Clear the list. The list will be empty after this call returns.

Specified by:
clear in interface java.util.Collection

length

public int length()
Returns length of this list (number of pairs)

Returns:
number of pairs in this list

isEmpty

public boolean isEmpty()
Checks if the list is empty (doesn't contain any pair)

Specified by:
isEmpty in interface java.util.Collection
Returns:
true - if list is empty and false otherwise

getEnumeration

public java.util.Enumeration getEnumeration()
Returns an Enumeration through this list. Type of elements in this Enumeration depends on list implementation (list specific pairs).

Returns:
Enumeration for the list

getEnumeration

public java.util.Enumeration getEnumeration(java.lang.String key)
Returns an Enumeration of pairs with specified key from this list. Type of elements in this Enumeration depends on list implementation (list specific pairs).

Returns:
Enumeration for the list

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Throws:
java.lang.CloneNotSupportedException

equals

public boolean equals(java.lang.Object obj)
Specified by:
equals in interface java.util.Collection

toString

public java.lang.String toString()

size

public int size()
Specified by:
size in interface java.util.Collection

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection

toArray

public java.lang.Object[] toArray(java.lang.Object[] a)
Specified by:
toArray in interface java.util.Collection

add

public boolean add(java.lang.Object o)
Specified by:
add in interface java.util.Collection

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.Collection

containsKey

public boolean containsKey(java.lang.Object key)

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection

addAll

public boolean addAll(java.util.Collection c)
Specified by:
addAll in interface java.util.Collection

containsAll

public boolean containsAll(java.util.Collection c)
Specified by:
containsAll in interface java.util.Collection

removeAll

public boolean removeAll(java.util.Collection c)
Specified by:
removeAll in interface java.util.Collection

retainAll

public boolean retainAll(java.util.Collection c)
Specified by:
retainAll in interface java.util.Collection

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.util.Collection

Configuration Platform SDK 7.6 API Reference

Send comments on this topic.
Copyright © 2006–2008 Genesys Telecommunication Laboratories, Inc. All rights reserved.