java.io.Serializable
, java.lang.Cloneable
, java.lang.Iterable<E>
, java.util.Collection
KeyValueCollection
public abstract class KVList
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable, java.util.Collection
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.
Pair
s.Modifier and Type | Class | Description |
---|---|---|
static interface |
KVList.PairList |
A list of key-value pairs.
|
Modifier and Type | Field | Description |
---|---|---|
protected KVList.PairList |
storage |
Pairs storage.
|
Constructor | Description |
---|---|
KVList() |
Modifier and Type | Method | Description |
---|---|---|
boolean |
add(java.lang.Object o) |
|
boolean |
addAll(java.util.Collection c) |
|
void |
addBinary(java.lang.String key,
byte[] data) |
Adds binary value to the list with specified key.
|
void |
addInt(java.lang.String key,
int value) |
Adds integer value to the list with specified key.
|
void |
addInt(java.lang.String key,
java.lang.Integer value) |
Adds integer value to the list with specified key.
|
void |
addObject(java.lang.String key,
java.lang.Object value) |
Adds supported value to this list with specified key.
|
void |
addString(java.lang.String key,
java.lang.String value) |
Adds string value to the list with specified key.
|
void |
addUTFString(java.lang.String key,
UTFValue value) |
Adds string value to the list with specified key.
|
void |
addUTFString(java.lang.String key,
java.lang.String value) |
Adds string value to the list with specified key.
|
void |
clear() |
Clears the list.
|
java.lang.Object |
clone() |
|
boolean |
contains(java.lang.Object o) |
|
boolean |
containsAll(java.util.Collection c) |
|
boolean |
containsKey(java.lang.Object key) |
|
protected abstract Pair |
createPair(java.lang.Object key) |
Creates list specific Pair implementation.
|
boolean |
equals(java.lang.Object obj) |
|
java.lang.String |
getAsString(java.lang.String key) |
Returns string representation of scalar value stored with specified key.
|
byte[] |
getBinary(java.lang.String key) |
Returns binary data stored with specified key.
|
java.util.Comparator |
getComparator() |
|
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) |
Returns integer value stored with specified key.
|
protected java.util.Enumeration |
getPairEnumeration(java.lang.Object key) |
Returns an
Enumeration of pairs with specified key
from this list. |
java.lang.String |
getString(java.lang.String key) |
Returns string value stored with specified key.
|
int |
hashCode() |
|
boolean |
isEmpty() |
Checks if the list is empty (doesn't contain any pair)s
|
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) |
|
protected Pair |
removePair(java.lang.Object key) |
Removes the pair with the specified key in this list.
|
boolean |
retainAll(java.util.Collection c) |
|
void |
setComparator(java.util.Comparator comparator) |
Sets Comparator used to check equality of Pairs' key in key-related searches.
|
int |
size() |
|
protected abstract void |
throwNotPair(java.lang.Object o) |
Checks that Object inserted to this KVList through Collection interface
is appropriate Pair implementation (e.g.
|
java.lang.Object[] |
toArray() |
|
java.lang.Object[] |
toArray(java.lang.Object[] a) |
|
java.lang.String |
toString() |
protected transient KVList.PairList storage
public void addBinary(java.lang.String key, byte[] data)
key
- key of the added pairdata
- binary datapublic void addInt(java.lang.String key, int value)
key
- key of the added pairvalue
- integer valuepublic void addInt(java.lang.String key, java.lang.Integer value)
key
- key of the added pairvalue
- integer valuepublic void addString(java.lang.String key, java.lang.String value)
addUTFString(String, String)
method.key
- key of the added pairvalue
- String valuepublic void addUTFString(java.lang.String key, java.lang.String value)
value
will be packed as UTF, but not key
.key
- key of the added pairvalue
- string valuepublic void addUTFString(java.lang.String key, UTFValue value)
value
will be packed as UTF, but not key
.key
- key of the added pairvalue
- UTF-string valuepublic void addObject(java.lang.String key, java.lang.Object value) throws java.lang.IllegalArgumentException
addUTFString(String, String)
.key
- key of the added pairvalue
- valuejava.lang.IllegalArgumentException
- if value has unsupported typepublic byte[] getBinary(java.lang.String key)
key
- key of the binary valuepublic java.lang.Integer getInt(java.lang.String key)
key
- key of the integer valuepublic java.lang.String getString(java.lang.String key)
key
- key of the valuepublic java.lang.String getAsString(java.lang.String key)
null
is returned.key
- key of the valuepublic void clear()
clear
in interface java.util.Collection
public int length()
public boolean isEmpty()
isEmpty
in interface java.util.Collection
public java.util.Enumeration getEnumeration()
Enumeration
through this list.
Type of elements in this Enumeration
depends
on list implementation (list specific pairs).public java.util.Enumeration getEnumeration(java.lang.String key)
Enumeration
of pairs with specified key
from this list. Type of elements in this Enumeration
depends on list implementation (list specific pairs).public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public boolean equals(java.lang.Object obj)
equals
in interface java.util.Collection
equals
in class java.lang.Object
public int hashCode()
hashCode
in interface java.util.Collection
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public int size()
size
in interface java.util.Collection
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection
public java.lang.Object[] toArray(java.lang.Object[] a)
toArray
in interface java.util.Collection
public boolean add(java.lang.Object o)
add
in interface java.util.Collection
public boolean contains(java.lang.Object o)
contains
in interface java.util.Collection
public boolean containsKey(java.lang.Object key)
public boolean remove(java.lang.Object o)
remove
in interface java.util.Collection
public boolean addAll(java.util.Collection c)
addAll
in interface java.util.Collection
public boolean containsAll(java.util.Collection c)
containsAll
in interface java.util.Collection
public boolean removeAll(java.util.Collection c)
removeAll
in interface java.util.Collection
public boolean retainAll(java.util.Collection c)
retainAll
in interface java.util.Collection
public java.util.Iterator iterator()
iterator
in interface java.util.Collection
iterator
in interface java.lang.Iterable<E extends java.lang.Object>
public void setComparator(java.util.Comparator comparator)
comparator
- the comparator to setpublic java.util.Comparator getComparator()
protected java.util.Enumeration getPairEnumeration(java.lang.Object key)
Enumeration
of pairs with specified key
from this list. Type of elements in this Enumeration
depends
on list implementation (list specific pairs).protected Pair removePair(java.lang.Object key)
key
- the key of the pair to be removedprotected abstract Pair createPair(java.lang.Object key)
key
- key of the pair to createprotected abstract void throwNotPair(java.lang.Object o)
o
- Object to insertSend comments on this topicTechpubs.webadmin@genesys.com.
Document version: 9.0.006.00
Copyright © 2006–2019 Genesys Telecommunications Laboratories, Inc. All rights reserved.