Platform SDK Java 8.5 API Reference

com.genesyslab.platform.commons.collections
Class KeyValueCollection

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

public class KeyValueCollection
extends KVList

A key-value list created from an ordered collection of key-value pairs. Nulls are not accepted either as a key or as a value.

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

This list supports String keys only. Values can be:

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.genesyslab.platform.commons.collections.KVList
KVList.PairList
 
Field Summary
 
Fields inherited from class com.genesyslab.platform.commons.collections.KVList
storage
 
Constructor Summary
  KeyValueCollection()
          Creates new empty list.
protected KeyValueCollection(KeyValueCollection list)
          Creates list from another list.
 
Method Summary
 void addList(java.lang.String key, KeyValueCollection list)
          Adds TKV list to this list under specified key.
 void addObject(java.lang.String key, java.lang.Object value)
          Adds supported value to this list with specified key.
 void addPair(KeyValuePair pair)
          Adds TKV pair to the list.
protected  Pair createPair(java.lang.Object key)
          Creates list specific Pair implementation.
 KeyValueCollection getList(java.lang.String key)
          Returns list value stored with specified key.
 KeyValuePair getPair(java.lang.String key)
          Returns TKV pair stored with specified key.
 KeyValuePair remove(java.lang.String key)
          Removes the pair with the specified String key from this list.
protected  void throwNotPair(java.lang.Object o)
          Checks that Object inserted to this KVList through Collection interface is appropriate Pair implementation (e.g.
 java.lang.String toString()
           
 java.lang.String toStringLine()
           
 
Methods inherited from class com.genesyslab.platform.commons.collections.KVList
add, addAll, addBinary, addInt, addInt, addString, addUTFString, addUTFString, clear, clone, contains, containsAll, containsKey, equals, getBinary, getComparator, getEnumeration, getEnumeration, getInt, getPairEnumeration, getString, hashCode, isEmpty, iterator, length, remove, removeAll, removePair, retainAll, setComparator, size, toArray, toArray
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KeyValueCollection

public KeyValueCollection()
Creates new empty list.


KeyValueCollection

protected KeyValueCollection(KeyValueCollection list)
Creates list from another list. Two lists will share the storage.

Parameters:
list - list to create this list from.
Method Detail

addPair

public void addPair(KeyValuePair pair)
Adds TKV pair to the list.

Parameters:
pair - TKV value

getPair

public KeyValuePair getPair(java.lang.String key)
Returns TKV pair stored with specified key. If no such key in list null is returned.

Parameters:
key - key of the pair
Returns:
pair or null if key not found

remove

public KeyValuePair remove(java.lang.String key)
Removes the pair with the specified String key from this list. Returns the pair that was removed from the list.

Parameters:
key - the key of the pair to be removed
Returns:
the element that was removed

addList

public void addList(java.lang.String key,
                    KeyValueCollection list)
Adds TKV list to this list under specified key.

Parameters:
key - the key of the list to be added
list - the list to add

getList

public KeyValueCollection getList(java.lang.String key)
Returns list value stored with specified key. If no such key in list or data is not TKVList (has some other type) null is returned.

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

addObject

public void addObject(java.lang.String key,
                      java.lang.Object value)
               throws java.lang.IllegalArgumentException
Description copied from class: KVList
Adds 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 KVList.addUTFString(String, String).

Overrides:
addObject in class KVList
Parameters:
key - key of the added pair
value - value
Throws:
java.lang.IllegalArgumentException - if value has unsupported type

toString

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

toStringLine

public java.lang.String toStringLine()

createPair

protected Pair createPair(java.lang.Object key)
Description copied from class: KVList
Creates list specific Pair implementation.

Specified by:
createPair in class KVList
Parameters:
key - key of the pair to create
Returns:
list specific Pair implementation

throwNotPair

protected void throwNotPair(java.lang.Object o)
Description copied from class: KVList
Checks that Object inserted to this KVList through Collection interface is appropriate Pair implementation (e.g. KeyValuePair for TKVList)s

Specified by:
throwNotPair in class KVList
Parameters:
o - Object to insert

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.