public class IDataUtil
extends java.lang.Object
Constructor and Description |
---|
IDataUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
append(IData src,
IData dst)
Appends the elements from one IData object to the end of another IData object.
|
static IData |
clone(IData src)
Returns a copy (a shallow clone) of the specified IData object.
|
static boolean |
contains(IDataCursor cursor,
java.lang.Object value)
Returns true if the IDataCursor contains the specified Object.
|
static void |
copy(IData src,
IData dst)
Copies all elements from one IData object to another IData object.
|
static IData |
create(java.lang.Object[][] data)
Deprecated.
03/2003;
Use IDataFactory.create() instead.
Creates an IData object and initializes its key/value pairs from the contents of a specified two-column array, where the first column of the array contains key names and the second column contains the values of those keys.
The first column of the array (the one that specifies key names) must contain only String values that represent key names. Anything other than a String in this column will cause a ClassCastException to occur at run time. If any member of the second column (the one that specifies values) of the array is null, that element is included in the IData object. If you DO NOT want to include null values in the IData object, use the create method provided by com.wm.data.IDataFactory instead. |
static IData |
deepClone(IData src)
Returns an independent copy (a deep clone) of the specified IData and its children.
|
static boolean |
equals(IData d1,
IData d2)
Indicates whether two IData objects contain the same keys and values.
|
static java.lang.Object |
get(IDataCursor cursor,
java.lang.String key)
Returns the Object at the specified key.
|
static boolean |
getBoolean(IDataCursor idc)
Returns the selected element (the one at the cursor's current position) as a boolean.
|
static IData |
getIData(IDataCursor idc)
Returns the selected element (the one at the cursor's current position) as an IData object.
|
static IData |
getIData(IDataCursor idc,
java.lang.String key)
Returns an IData representation of the value at the specified key.
|
static IData[] |
getIDataArray(IDataCursor idc,
java.lang.String key)
Returns an IData[] representation of the value at the specified key.
|
static int |
getInt(IDataCursor idc)
Returns the selected element (the one at the cursor's current position) as an int or returns -1 if the element cannot be converted to an int.
|
static int |
getInt(IDataCursor idc,
int def)
Returns the selected element (the one at the cursor's current position) as an int or returns a default value if the element cannot be converted to an int.
|
static int |
getInt(IDataCursor idc,
java.lang.String key,
int def)
Returns an int representation of the value at the specified key or returns a default value if the element cannot be converted to an int.
|
static java.lang.String |
getNonEmptyString(IDataCursor cursor,
java.lang.String key)
Returns the value associated with the key in an IData object as a non-empty String.
|
static java.lang.Object[] |
getObjectArray(IDataCursor idc,
java.lang.String key)
Returns an Object[] representation of the value at the specified key.
|
static java.lang.String |
getString(IDataCursor idc)
Returns the selected element (the one at the cursor's current position) as a String.
|
static java.lang.String |
getString(IDataCursor idc,
java.lang.String key)
Returns a String representation of the value at the specified key.
|
static java.lang.String[] |
getStringArray(IDataCursor idc)
Returns the selected element (the one at the cursor's current position) as a String[].
|
static java.lang.String[] |
getStringArray(IDataCursor idc,
java.lang.String key)
Returns a String[] representation of the value at the specified key.
|
static java.lang.String[][] |
getStringTable(IDataCursor idc)
Returns the selected element (the one at the cursor's current position) as a String[][].
|
static java.lang.String[][] |
getStringTable(IDataCursor idc,
java.lang.String key)
Returns a String[][] representation of the value at the specified key.
|
static void |
merge(IData src,
IData dst)
Merges one IData object with another IData object.
|
static void |
put(IDataCursor cursor,
java.lang.String key,
java.lang.Object value)
Adds an Object at the specified key in an IData object.
|
static void |
putInt(IDataCursor cursor,
java.lang.String key,
int value)
Adds an int at the specified key in an IData object.
|
static void |
remove(IDataCursor idc,
java.lang.String key)
Deletes an element from an IData given the element’s key.
|
static int |
size(IDataCursor cursor)
Returns the number of top-level elements in the IDataCursor.
|
static IData[] |
sortIDataArrayByKey(IData[] dataArray,
java.lang.String key,
int compareType,
java.lang.String pattern,
boolean reverse)
Sorts an IData[] on a given key according to the criteria specified in the compareType, pattern, and order parameters.
|
public static IData create(java.lang.Object[][] data)
The first column of the array (the one that specifies key names) must contain only String values that represent key names. Anything other than a String in this column will cause a ClassCastException to occur at run time.
If any member of the second column (the one that specifies values) of the array is null, that element is included in the IData object. If you DO NOT want to include null values in the IData object, use the create method provided by com.wm.data.IDataFactory instead.
IDataFactory.create(Object[][])
public static java.lang.Object get(IDataCursor cursor, java.lang.String key)
cursor
- an IDataCursor that points to the IData from which you want to retrieve the Object.key
- a String specifying the key whose value you want to retrieve.public static IData getIData(IDataCursor idc)
idc
- the IDataCursor that points to the element that getIData is to return.public static IData getIData(IDataCursor idc, java.lang.String key)
idc
- An IDataCursor that points to the IData containing the element that you want to retrieve.key
- A String specifying the key that you want to retrieve.public static java.lang.String getString(IDataCursor idc)
idc
- the IDataCursor that points to the element that getString is to return.public static java.lang.String getNonEmptyString(IDataCursor cursor, java.lang.String key)
cursor
- a cursor of an IData.key
- the key whose value is to be returned.public static java.lang.String getString(IDataCursor idc, java.lang.String key)
idc
- an IDataCursor that points to the IData containing the element that you want to retrieve.key
- a String specifying the key that you want to retrieve.public static java.lang.String[] getStringArray(IDataCursor idc)
idc
- The IDataCursor that points to the element that getStringArray is to return.public static java.lang.String[] getStringArray(IDataCursor idc, java.lang.String key)
idc
- an IDataCursor that points to the IData containing the element that you want to retrieve.key
- a String specifying the key that you want to retrieve.public static java.lang.String[][] getStringTable(IDataCursor idc)
idc
- the IDataCursor that points to the element that getStringTable is to return.public static java.lang.String[][] getStringTable(IDataCursor idc, java.lang.String key)
idc
- an IDataCursor that points to the IData containing the element that you want to retrieve.key
- a String specifying the key whose value you want to retrieve.public static boolean getBoolean(IDataCursor idc)
idc
- the IDataCursor that points to the element that getBoolean is to return.public static int getInt(IDataCursor idc)
idc
- the IDataCursor that points to the element that getInt is to return.public static int getInt(IDataCursor idc, int def)
idc
- the IDataCursor that points to the element that getInt is to return.def
- the int value that getInt will return if the selected element is null or cannot be converted to an int.public static int getInt(IDataCursor idc, java.lang.String key, int def)
idc
- an IDataCursor that points to the IData containing the element that you want to retrieve.key
- a String specifying the key whose value you want to retrieve.def
- the default int to return if the specified key is null or not an int.public static IData[] getIDataArray(IDataCursor idc, java.lang.String key)
idc
- an IDataCursor that points to the IData containing the element that you want to retrieve.key
- a String specifying the key whose value you want to retrieve.public static java.lang.Object[] getObjectArray(IDataCursor idc, java.lang.String key)
idc
- an IDataCursor that points to IData containing the element that you want to retrieve.key
- a String specifying the key whose value you want to retrieve.public static void put(IDataCursor cursor, java.lang.String key, java.lang.Object value)
cursor
- an IDataCursor that points to the IData to which you want to add an Object.key
- a String specifying the key at which the Object is to be added.value
- the Object that is to be added at the specified key.public static void putInt(IDataCursor cursor, java.lang.String key, int value)
cursor
- an IDataCursor that points to the IData to which you want to add an int.key
- a String specifying the key at which the int is to be added.value
- the int that is to be added at the specified key.public static void append(IData src, IData dst)
src
- the IData object whose elements are to be copied.dst
- the IData object into which the elements from the source object will be appended.copy(com.wm.data.IData, com.wm.data.IData)
,
merge(com.wm.data.IData, com.wm.data.IData)
public static void merge(IData src, IData dst)
src
- the IData object whose elements are to be copied.dst
- the IData object into which the elements from the source object will be merged.copy(com.wm.data.IData, com.wm.data.IData)
,
merge(com.wm.data.IData, com.wm.data.IData)
public static void copy(IData src, IData dst)
src
- the IData object whose elements are to be copied.dst
- the IData object into which the elements from the source object will be copied.append(com.wm.data.IData, com.wm.data.IData)
,
merge(com.wm.data.IData, com.wm.data.IData)
public static IData clone(IData src)
src
- the IData object that is to be copied.deepClone(com.wm.data.IData)
public static IData deepClone(IData src)
src
- the IData object that you want to copy.clone(com.wm.data.IData)
public static IData[] sortIDataArrayByKey(IData[] dataArray, java.lang.String key, int compareType, java.lang.String pattern, boolean reverse)
dataArray
- the IData[] object that is to be sorted.key
- a String specifying the key on which the IData[] is to be sorted.compareType
- an int specifying the comparison type. Valid choices
are: pattern
- a String specifying the pattern to sort by. When used with IDataUtil.COMPARE_TYPE_TIME and set to null, a default pattern of MM/dd/yyyy hh:mm:ss a is used, where “a” indicates the a.m./p.m. marker. See the java.text SimpleDateFormat class for more information about date and time patterns.reverse
- a Boolean specifying whether the IData[] is to be sorted in descending order. Set to true for descending order.public static boolean equals(IData d1, IData d2)
Note: Null elements are evaluated in the same way as other keys and values. As long as two null elements have the same key name and both keys are in the same position within their respective IData objects, the two elements will be considered equal.
d1
- an IData object that will be compared to the IData object specified in d2.d2
- an IData object that will be compared to the IData object specified in d1.public static void remove(IDataCursor idc, java.lang.String key)
idc
- an IDataCursor that points to the IData containing the element that you want to delete.key
- a String specifying the key whose value you want to remove.public static int size(IDataCursor cursor)
cursor
- an IDataCursor that points to the IData whose elements you want to count.public static boolean contains(IDataCursor cursor, java.lang.Object value)
cursor
- an IDataCursor that points to the IData that you want to search.
if the specified Object exists in it.value
- the Object that you want contains to look for.