public class ObjectUtil extends Object
Constructor and Description |
---|
ObjectUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
buildObject(Object targetObject,
Object sourceObject)
Populate the target object with the source object
|
static void |
buildObject(Object targetObject,
Object[] sourceObject,
List<String> keyFields)
Populate the given fields of the target object with the values of an array
|
static void |
buildObject(Object targetObject,
Object sourceObject,
List<String> keyFields)
Populate the given fields of the target object with the corresponding field values of source object
|
static void |
buildObjectWithoutReferenceFields(Object targetObject,
Object sourceObject)
Populate the target object with the source object
|
static Map<String,Object> |
buildPropertyMap(Object object,
List<String> keyFields)
build a map of business object with its specified property names and corresponding values
|
static String |
concatPropertyAsString(Object object,
List<String> keyFields)
concat the specified properties of the given object as a string
|
static void |
convertLineToBusinessObject(Object targetObject,
String line,
int[] fieldLength,
List<String> keyFields)
Tokenize the input line with the given deliminator and populate the given object with values of the tokens
|
static void |
convertLineToBusinessObject(Object targetObject,
String line,
String delim,
List<String> keyFields)
Tokenize the input line with the given deliminator and populate the given object with values of the tokens
|
static void |
convertLineToBusinessObject(Object targetObject,
String line,
String delim,
String fieldNames)
Tokenize the input line with the given deliminator and populate the given object with values of the tokens
|
static <T> T |
createObject(Class<T> clazz)
create an object of the specified type
|
static boolean |
equals(Object targetObject,
Object sourceObject,
List<String> keyFields)
Determine if they have the same values in the specified fields
|
static Date |
formatDate(String value)
convert the given string into a date
|
static Timestamp |
formatTimeStamp(String value)
convert the given string into a timestamp object if the string is in the valid format of timestamp
|
static int |
generateHashCode(Object object,
List<String> keyFields)
compute the hash code for the given object from the given fields
|
static Map<Class<?>,String> |
getNestedAttributeTypes(Class<?> clazz,
String nestedAttribute)
get the types of the nested attributes starting at the given class
|
static String |
getSimpleTypeName(Object targetObject,
String propertyName) |
static boolean |
hasNullValueField(Object sourceObject)
determine if the source object has a field with null as its value
|
static boolean |
isDecimal(String value)
determine if the given string can be converted into a decimal
|
static boolean |
isInteger(String value)
determine if the given string can be converted into an Integer
|
static void |
populateBusinessObject(Object businessOjbject,
Properties properties,
String propertyKey,
int[] fieldLength,
List<String> keyFields)
Populate a business object with the given properities and information
|
static void |
populateBusinessObject(Object businessOjbject,
Properties properties,
String propertyKey,
String fieldNames,
String deliminator)
Populate a business object with the given properities and information
|
static void |
setProperty(Object targetObject,
Object sourceObject,
org.apache.commons.beanutils.DynaProperty property,
boolean skipReferenceFields)
Populate the property of the target object with the counterpart of the source object
|
static List<String> |
split(String line,
String delim)
Tokenize the input line with the given deliminator and store the tokens in a list
|
static Object |
valueOf(String type,
String propertyValue)
Get an object of the given type holding the property value of the specified String.
|
public ObjectUtil()
public static <T> T createObject(Class<T> clazz)
clazz
- the specified type of the objectpublic static void buildObject(Object targetObject, Object sourceObject, List<String> keyFields)
targetObject
- the target objectsourceObject
- the source objectkeyFields
- the given fields of the target object that need to be popluatedpublic static void buildObject(Object targetObject, Object[] sourceObject, List<String> keyFields)
targetObject
- the target objectsourceObject
- the given arraykeyFields
- the given fields of the target object that need to be popluatedpublic static String getSimpleTypeName(Object targetObject, String propertyName)
public static Object valueOf(String type, String propertyValue)
type
- the given type of the returning objectpropertyValue
- the property value of the specified stringpublic static boolean isInteger(String value)
value
- the value of the specified stringpublic static boolean isDecimal(String value)
value
- the value of the specified stringpublic static Date formatDate(String value)
value
- the given stringpublic static Timestamp formatTimeStamp(String value)
value
- the given stringpublic static void buildObject(Object targetObject, Object sourceObject)
targetObject
- the target objectsourceObject
- the source objectpublic static void buildObjectWithoutReferenceFields(Object targetObject, Object sourceObject)
targetObject
- the target objectsourceObject
- the source objectpublic static void setProperty(Object targetObject, Object sourceObject, org.apache.commons.beanutils.DynaProperty property, boolean skipReferenceFields)
targetObject
- the target objectsourceObject
- the source objectproperty
- the specified propety of the target objectskipReferenceFields
- determine whether the referencing fields need to be populatedpublic static boolean equals(Object targetObject, Object sourceObject, List<String> keyFields)
targetObject
- the target objectsourceObject
- the source objectkeyFields
- the specified fieldspublic static int generateHashCode(Object object, List<String> keyFields)
object
- the given objectkeyFields
- the specified fieldspublic static Map<String,Object> buildPropertyMap(Object object, List<String> keyFields)
businessObject
- the given business objectthe
- specified fields that need to be included in the return mappublic static String concatPropertyAsString(Object object, List<String> keyFields)
object
- the given objectthe
- specified fields that need to be included in the return stringpublic static void convertLineToBusinessObject(Object targetObject, String line, String delim, List<String> keyFields)
targetObject
- the target objectline
- the input linedelim
- the deminator that separates the fields in the given linekeyFields
- the specified fieldspublic static void convertLineToBusinessObject(Object targetObject, String line, String delim, String fieldNames)
targetObject
- the target objectline
- the input linedelim
- the deminator that separates the fields in the given linekeyFields
- the specified fieldspublic static List<String> split(String line, String delim)
line
- the input linedelim
- the deminator that separates the fields in the given linepublic static void convertLineToBusinessObject(Object targetObject, String line, int[] fieldLength, List<String> keyFields)
targetObject
- the target objectline
- the input linedelim
- the deminator that separates the fields in the given linekeyFields
- the specified fieldspublic static void populateBusinessObject(Object businessOjbject, Properties properties, String propertyKey, String fieldNames, String deliminator)
businessOjbject
- the business object to be populatedproperties
- the given propertiespropertyKey
- the property keys in the propertiesfieldNames
- the names of the fields to be populateddeliminator
- the deliminator that separates the values to be used in a stringpublic static void populateBusinessObject(Object businessOjbject, Properties properties, String propertyKey, int[] fieldLength, List<String> keyFields)
businessOjbject
- the business object to be populatedproperties
- the given propertiespropertyKey
- the property keys in the propertiesfieldNames
- the names of the fields to be populateddeliminator
- the deliminator that separates the values to be used in a stringpublic static boolean hasNullValueField(Object sourceObject)
sourceObject
- the source objectpublic static Map<Class<?>,String> getNestedAttributeTypes(Class<?> clazz, String nestedAttribute)
clazz
- the given classnestedAttribute
- the nested attributes of the given classCopyright © 2004-2014 The Kuali Foundation. All Rights Reserved.