public class ObjectHandler
extends java.lang.Object
getKey()
method to your own
object and this class will try to use it with its own getKey
method.Constructor and Description |
---|
ObjectHandler() |
Modifier and Type | Method and Description |
---|---|
static boolean |
classInstance(java.lang.Class param1,
java.lang.Class param2)
Check if the two parameters match with regard to class type.
|
static boolean |
classInstance(java.lang.Class param1,
java.lang.Object obj2)
Check if the two parameters match with regard to class type.
|
static java.lang.Object |
convertParameter(java.lang.Object param)
Try to convert the parameter into an Object if possible.
|
static java.lang.Object |
dataXmlToValue(org.licas_xml.abs.Element dataXml)
Parse the data element from the service info to create the related Java Object.
|
static boolean |
equals(java.lang.Object ob1,
java.lang.Object ob2)
Return true if the two objects are equal to each other as defined by this method.
|
static java.lang.String |
getClass(java.lang.Object theObject)
Return the object class name in a format suitable for logging.
|
static org.licas_xml.abs.Element |
getElementPath(java.lang.Object ob1)
Return an Element defining the path to the object specified.
|
static java.lang.String |
getKey(java.lang.Object ob1)
Return the key relating to the object specified.
|
static java.lang.String |
getValue(java.lang.Object theValue)
Return a String-based representation of the object value.
|
static boolean |
isArrayList(java.lang.String type)
Return true if type is an ArrayList type.
|
static boolean |
isArrayType(java.lang.String type)
Return true if type is an array type type.
|
static boolean |
isBoolean(java.lang.Object obj)
Return true if the object indicates a Boolean object.
|
static boolean |
isElement(java.lang.Object obj)
Return true if the object indicates an XML element.
|
static boolean |
isHashMap(java.lang.String type)
Return true if type is a HashMap type.
|
static boolean |
isHashtable(java.lang.String type)
Return true if type is a Hashtable type.
|
static boolean |
isLinkedHashMap(java.lang.String type)
Return true if type is a LinkedHashMap type.
|
static boolean |
isLinkedList(java.lang.String type)
Return true if type is a LinkedList type.
|
static boolean |
isNull(java.lang.Object obj)
Return true if the object represents the null type.
|
static boolean |
isObject(java.lang.Object obj)
Return true if the object indicates the base Object type.
|
static boolean |
isStack(java.lang.String type)
Return true if type is a Stack type.
|
static boolean |
isString(java.lang.Object obj)
Return true if the object indicates a String object.
|
static boolean |
isVector(java.lang.String type)
Return true if type is a Vector type.
|
static long |
sizeOf(java.lang.Object theObj)
For actual object instances, but not sure how accurate or how to use best.
|
static java.lang.String |
toObjectClass(java.lang.String paramClass)
Convert a primitive type class description into the related object description.
|
static java.lang.String |
typeCode(java.lang.String type)
Return a code value for the type if one exists.
|
static java.lang.Object |
valueFromString(java.lang.String valueType,
java.lang.String value)
Convert the String representation to the value object.
|
static boolean |
valueIsFalse(java.lang.Object var)
Return true if the variable indicates a false value.
|
static boolean |
valueIsTrue(java.lang.Object var)
Return true if the variable indicates a true value.
|
static java.lang.String |
valueToString(java.lang.String valueType,
java.lang.Object value)
Return the value as a String.
|
public static java.lang.String getKey(java.lang.Object ob1) throws java.lang.Exception
getKey()
method, an
attempt to invoke that is tried, if that fails then the String
value of the
object is returned.ob1
- the representation of the object.java.lang.Exception
- any error.public static java.lang.String getValue(java.lang.Object theValue) throws java.lang.Exception
String.valueOf()
. If the value is a service,
then it will try to retrieve the uuid name.theValue
- the object value to describe.java.lang.Exception
- any error.public static java.lang.String getClass(java.lang.Object theObject)
theObject
- the object to describe.public static org.licas_xml.abs.Element getElementPath(java.lang.Object ob1) throws java.lang.Exception
ob1
- the representation of the object.java.lang.Exception
- any error.public static boolean equals(java.lang.Object ob1, java.lang.Object ob2) throws java.lang.Exception
ob1
- the first object to compare.ob2
- the second object to compare.java.lang.Exception
- any error.public static java.lang.Object convertParameter(java.lang.Object param)
param
- the parameter in String format. Can also represent a list.public static boolean classInstance(java.lang.Class param1, java.lang.Object obj2)
param1
- the first parameter class. Also the base class to match.obj2
- the parameter object that might be of that type.public static boolean classInstance(java.lang.Class param1, java.lang.Class param2)
param1
- the first parameter class. Also the base class to match.param2
- the second parameter class that might be of that type.public static java.lang.String toObjectClass(java.lang.String paramClass)
paramClass
- string-based description of the class.public static java.lang.String typeCode(java.lang.String type)
type
- the object type.public static boolean isBoolean(java.lang.Object obj)
obj
- the object to check.public static boolean isString(java.lang.Object obj)
obj
- the object to check.public static boolean isElement(java.lang.Object obj)
obj
- the object to check.public static boolean isObject(java.lang.Object obj)
obj
- the object to check.public static boolean isArrayType(java.lang.String type)
type
- the object type.public static boolean isArrayList(java.lang.String type)
type
- the object type.public static boolean isVector(java.lang.String type)
type
- the object type.public static boolean isLinkedList(java.lang.String type)
type
- the object type.public static boolean isHashtable(java.lang.String type)
type
- the object type.public static boolean isHashMap(java.lang.String type)
type
- the object type.public static boolean isLinkedHashMap(java.lang.String type)
type
- the object type.public static boolean isStack(java.lang.String type)
type
- the object type.public static boolean valueIsTrue(java.lang.Object var)
var
- the variable to check. Can be Boolean, String or query OK element.public static boolean valueIsFalse(java.lang.Object var)
var
- the variable to check. Can be Boolean, String or query Not_OK element.public static boolean isNull(java.lang.Object obj)
obj
- the object to check.Const
.NULL
.public static long sizeOf(java.lang.Object theObj)
theObj
- the object instance to measure.public static java.lang.Object dataXmlToValue(org.licas_xml.abs.Element dataXml) throws java.lang.Exception
dataXml
- this is the base data or dataset element with nested elements that include
directly, Const
.DATATYPE
, DATASETTYPE
and then VALUE
elements for parsing. If they are missing, a convertParameter
call is
tried on the whole XML object.java.lang.Exception
- any error.public static java.lang.String valueToString(java.lang.String valueType, java.lang.Object value) throws java.lang.Exception
String.valueOf(value)
is returned.valueType
- the type of the value.value
- the value.java.lang.Exception
- any error.public static java.lang.Object valueFromString(java.lang.String valueType, java.lang.String value) throws java.lang.Exception
valueType
- the type of the value.value
- the value as a String.java.lang.Exception
- any error.