public class Values extends java.lang.Object implements IData, Codable, java.io.Serializable
Important! Do not use java.io.Serializable from this class, because it is not compatible across versions of the webMethods Integration Server. You can serialize Values objects and maintain compatibility across versions by using com.wm.util.coder.XMLCoder or, for webMethods Integration Server 3.5 and above, com.wm.util.coder.IDataXMLCoder.
Values is a subclass that emulates a Hashtable but has four key differentiators:
Note: equals() will fail for Vectors passed via RPC
IData
,
Coder
,
Serialized FormConstructor and Description |
---|
Values() |
Values(java.util.Hashtable h)
Create a Values object by copying elements and keys
from a given Hashtable.
|
Values(int size)
Create a Values Object with the specified size.
|
Values(java.lang.Object[][] values)
Create a Values Object and pre-fills it with the designated
array of Objects.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Performs a shallow clone of a Values object.
|
Values |
copyFrom(java.util.Hashtable v)
Copies the elements from the given Hashtable object into
the current Values object.
|
Values |
copyFrom(Values v)
Copies the elements from the given Values object into
the current Values object.
|
boolean |
equals(java.lang.Object in)
Tests two Values objects for equality.
|
java.lang.Object |
get(int index)
Returns an object given its position in the Values object.
|
java.lang.Object |
get(java.lang.String key)
Deprecated.
|
boolean |
getBoolean(java.lang.String key)
Helper function that returns the value as a 'boolean' if its String
value is parsable as a boolean.
|
int |
getInt(java.lang.String key)
Helper function that returns the value as an 'int' if its String
value is parsable as an int.
|
int |
getInt(java.lang.String key,
int def)
Helper function that returns the value as an 'int' if its String
value is parsable as an int.
|
long |
getLong(java.lang.String key)
Helper function that returns the value as a 'long' if its String
value is parsable as a long.
|
long |
getLong(java.lang.String key,
long def)
Helper function that returns the value as a 'long' if its String
value is parsable as a long.
|
java.lang.String |
getNonEmptyString(java.lang.String key)
Helper function that returns the value as a non-empty
String (i.e., not all whitespace).
|
java.lang.String |
getString(java.lang.String key)
Helper function that returns the value as a String if
it is a String.
|
java.lang.String[] |
getStringArray(java.lang.String key)
Helper function that returns the value as a String[]
if it is a String[].
|
java.lang.String[][] |
getStringTable(java.lang.String key)
Helper function that returns the value as a String[][]
if it is a String[][].
|
java.lang.String |
getTrimmedString(java.lang.String key)
Helper function that returns the value as a trimmed
String (i.e., no leading or trailing whitespace).
|
Values |
getValues(java.lang.String key)
Helper function that returns the value as a Values object if
it is a Values.
|
Values[] |
getValuesArray(java.lang.String key)
Helper function that returns the value as a Values[] object if
it is a Values[] or Table.
|
int |
hashCode()
Calculates a hash value for this Values object.
|
boolean |
isEmpty()
Returns true if there are no elements in this Values object.
|
java.lang.Object |
put(java.lang.Object value)
Adds an "unnamed" object which can be retrieved
by a positional get(int).
|
java.lang.Object |
put(java.lang.String key,
int value)
put() which converts int value to a String object.
|
java.lang.Object |
put(java.lang.String key,
long value)
put() which converts long value to a String object.
|
java.lang.Object |
put(java.lang.String key,
java.lang.Object value)
Deprecated.
|
java.lang.Object |
remove(java.lang.String key)
Deprecated.
|
java.util.Enumeration |
sortedKeys()
Returns an Enumeration of the sorted keys (names) in this Values object.
|
java.lang.String |
toString()
Display the contents of this Values object.
|
static Values |
use(IData data)
Deprecated.
|
getCursor, getHashCursor, getIndexCursor, getSharedCursor, getTreeCursor
getValue, getValueKeys, setValue
public Values()
public Values(java.util.Hashtable h)
public Values(int size)
public Values(java.lang.Object[][] values)
Object o[][] = { { "key1", new Integer(123) } , { "key2", "This is a string" }, { "key3", new Object() } } Values v = new Values(o);Note that the Object array is a two dimensional array where the first column is constrained to String values. Using anything other than Strings in the first column will result in a ClassCastException being thrown.
public java.lang.Object put(java.lang.Object value)
public java.lang.Object put(java.lang.String key, int value)
public java.lang.Object put(java.lang.String key, long value)
public Values getValues(java.lang.String key)
public Values[] getValuesArray(java.lang.String key)
public java.lang.String getString(java.lang.String key)
public java.lang.String getNonEmptyString(java.lang.String key)
public java.lang.String getTrimmedString(java.lang.String key)
public java.lang.String[] getStringArray(java.lang.String key)
public java.lang.String[][] getStringTable(java.lang.String key)
public int getInt(java.lang.String key)
public int getInt(java.lang.String key, int def)
public long getLong(java.lang.String key)
public long getLong(java.lang.String key, long def)
public boolean getBoolean(java.lang.String key)
public java.lang.Object get(int index)
index
- Index of element (from its put order)public boolean isEmpty()
Hashtable.isEmpty()
public java.util.Enumeration sortedKeys()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object in)
equals
in class java.lang.Object
public java.lang.Object clone()
Duplicates all key and element references, but not the actual data elements (nor the private data).
clone
in class java.lang.Object
Hashtable.clone()
public Values copyFrom(Values v)
public Values copyFrom(java.util.Hashtable v)
public java.lang.Object get(java.lang.String key)
public java.lang.Object put(java.lang.String key, java.lang.Object value)
public java.lang.Object remove(java.lang.String key)
public java.lang.String toString()
toString
in class java.lang.Object