public class DataUtils extends Object
Constructor and Description |
---|
DataUtils() |
Modifier and Type | Method and Description |
---|---|
static int[] |
addressOfChild(TreeNode parent,
String childPath)
This tries to find the address of a child given its path from the parent.
|
static int[] |
addressOfChild(TreeNode parent,
TreeNode child)
Get the address of a child in the specified parent.
|
static String |
appendAllFields(String fieldName,
Object dataObject,
boolean declaredOnly)
Look through the dataObject class and possibly its superclasses to locate in each
the String field named "fieldName" and then append them all together.
|
static byte[] |
encodeBytes(ByteEncodable be)
This method uses the implementation of int encodeBytes(ByteArray dest) method of a ByteEncodable to implement the
byte[] encodeBytes() method.
|
static int |
encodeBytes(ByteEncodable be,
ByteArray destination)
This method uses the implementation of byte[] encodeBytes() method of a ByteEncodable to implement the
int encodeBytes(ByteArray dest) method.
|
static TreeNode |
findNamedChild(TreeNode parent,
String name) |
static Collection |
getAllFields(String fieldName,
Object dataObject,
boolean declaredOnly,
Collection dest)
Look through the dataObject class and possibly its superclasses to locate in each
the String field named "fieldName" and then add them all to the destination dest.
|
static Class[] |
getCachedClassList(Class c,
String methodNameAndSpecs) |
static Field[] |
getCachedFieldList(Class theClass,
Object dataObject,
boolean declaredOnly) |
static TreeNode |
getChildAt(TreeNode parent,
int[] address)
Get the child at the specified address.
|
static String |
getFieldList(Class theClass,
Object dataObject,
boolean declaredOnly)
Get a comma separated list of fields for the specified object.
|
static String |
getFieldList(Object objectOrClass,
boolean declaredOnly)
Get a comma separated list of fields for the specified object.
|
static TreeNode |
getParent(TreeNode child,
int levels) |
static TreeNode |
getSibling(TreeNode child,
int change) |
static boolean |
isNamed(Object data,
String name) |
static String |
nameToPrompt(String name)
This converts a name with underscores to a prompt with capital letters and spaces where
the underscores were.
|
public static TreeNode getChildAt(TreeNode parent, int[] address)
parent
- the parent node.address
- the address of the child.public static int[] addressOfChild(TreeNode parent, TreeNode child)
parent
- the parent node.child
- the child node.public static int[] addressOfChild(TreeNode parent, String childPath)
public static Collection getAllFields(String fieldName, Object dataObject, boolean declaredOnly, Collection dest)
fieldName
- the name of the field (e.g. "_formats").dataObject
- the data object.declaredOnly
- if this is true then only the declared field will be searched.a
- destination Collection or null to create and return a new Vector().public static String appendAllFields(String fieldName, Object dataObject, boolean declaredOnly)
fieldName
- the name of the field (e.g. "_fields").dataObject
- the data object.declaredOnly
- if this is true then only the declared field will be searched.public static Field[] getCachedFieldList(Class theClass, Object dataObject, boolean declaredOnly)
public static String getFieldList(Class theClass, Object dataObject, boolean declaredOnly)
theClass
- the Class for the object.dataObject
- an instance of the object, which is necessary if the "_fields" field is used to
specifiy fields.declaredOnly
- if this is true only the field declared by the class (not those inherited)
are used.public static String getFieldList(Object objectOrClass, boolean declaredOnly)
objectOrClass
- the object, or Class of the object.declaredOnly
- if this is true only the field declared by the class (not those inherited)
are used.public static String nameToPrompt(String name)
name
- public static final byte[] encodeBytes(ByteEncodable be)
be
- a ByteEncodable Object that implements fully the int encodeBytes(ByteArray dest) method.public static final int encodeBytes(ByteEncodable be, ByteArray destination)
be
- a ByteEncodable Object that implements fully the byte[] encodeBytes() method.