@Deprecated public final class ObjectUtils extends Object
Modifier and Type | Method and Description |
---|---|
static String |
clean(String string)
Deprecated.
Removes all query characters from a string.
|
static boolean |
collectionContainsObjectWithIdentitcalKey(Collection<? extends PersistableBusinessObject> controlList,
PersistableBusinessObject bo)
Deprecated.
|
static int |
countObjectsWithIdentitcalKey(Collection<? extends PersistableBusinessObject> collection,
PersistableBusinessObject bo)
Deprecated.
Compares a business object with a Collection of
PersistableBusinessObject s to count how many have the
same key as the BO. |
static void |
createHybridBusinessObject(BusinessObject businessObject,
BusinessObject source,
Map<String,String> template)
Deprecated.
|
static BusinessObject |
createHybridBusinessObject(Class businessObjectClass,
BusinessObject source,
Map<String,String> template)
Deprecated.
Creates a new instance of a given BusinessObject, copying fields specified in template from the given source BO.
|
static Object |
createNewObjectFromClass(Class clazz)
Deprecated.
This method safely creates a object from a class
Convenience method to create new object and throw a runtime exception if it cannot
If the class is an
ExternalizableBusinessObject , this method will determine the interface for the EBO and
query the
appropriate module service to create a new instance. |
static Serializable |
deepCopy(Serializable src)
Deprecated.
Uses Serialization mechanism to create a deep copy of the given Object.
|
static CopiedObject |
deepCopyForCaching(Serializable src)
Deprecated.
Uses Serialization mechanism to create a deep copy of the given Object, and returns a CacheableObject instance
containing the
deepCopy and its size in bytes.
|
static Class |
easyGetPropertyType(Object object,
String propertyName)
Deprecated.
This method simply uses PojoPropertyUtilsBean logic to get the Class of a Class property.
|
static boolean |
equalByKeys(PersistableBusinessObject bo1,
PersistableBusinessObject bo2)
Deprecated.
|
static String |
formatPropertyValue(Object propertyValue)
Deprecated.
Based on the value type selects a formatter and returns the formatted
value as a string
|
static Object |
fromByteArray(byte[] bytes)
Deprecated.
reconsitiutes the object that was converted into a byte array by toByteArray
|
static List<Field> |
getAllFields(List<Field> fields,
Class<?> type,
Class<?> stopAt)
Deprecated.
Retrieves all fields including the inherited fields for a given class.
|
static String |
getFormattedPropertyValue(BusinessObject businessObject,
String propertyName,
Formatter formatter)
Deprecated.
|
static String |
getFormattedPropertyValueUsingDataDictionary(BusinessObject businessObject,
String propertyName)
Deprecated.
References the data dictionary to find any registered formatter class then if not found checks for associated
formatter for the
property type.
|
static Formatter |
getFormatterWithDataDictionary(Object bo,
String propertyName)
Deprecated.
|
static String |
getMD5Hash(Object object)
Deprecated.
use MD5 to create a one way hash of an object
|
static String |
getNestedAttributePrefix(String attributeName)
Deprecated.
Returns the prefix of a nested attribute name, or the empty string if the attribute name is not nested.
|
static String |
getNestedAttributePrimitive(String attributeName)
Deprecated.
Returns the primitive part of an attribute name string.
|
static Object |
getNestedValue(Object bo,
String fieldName)
Deprecated.
This method safely extracts either simple values OR nested values.
|
static Class |
getPropertyType(Object object,
String propertyName,
PersistenceStructureService persistenceStructureService)
Deprecated.
|
static Object |
getPropertyValue(Object businessObject,
String propertyName)
Deprecated.
|
static boolean |
isNestedAttribute(String attributeName)
Deprecated.
Determines if a given string could represent a nested attribute of an object.
|
static boolean |
isNotNull(Object object)
Deprecated.
This method is a OJB Proxy-safe way to test for notNull on a proxied object that may or may not be materialized
yet.
|
static boolean |
isNull(Object object)
Deprecated.
This method is a OJB Proxy-safe way to test for null on a proxied object that may or may not be materialized yet.
|
static boolean |
isWriteable(Object object,
String property,
PersistenceStructureService persistenceStructureService)
Deprecated.
Return whether or not an attribute is writeable.
|
static void |
materializeAllSubObjects(PersistableBusinessObject bo)
|
static Class |
materializeClassForProxiedObject(Object object)
Deprecated.
Attempts to find the Class for the given potentially proxied object
|
static void |
materializeObjects(Collection possiblyProxiedObjects)
Deprecated.
This method runs the ObjectUtils.isNotNull() method for each item in a list of BOs.
|
static void |
materializeSubObjectsToDepth(PersistableBusinessObject bo,
int depth)
|
static void |
materializeUpdateableCollections(Object bo)
Deprecated.
|
static <T> T |
newInstance(Class<T> clazz)
Deprecated.
Helper method for creating a new instance of the given class
|
static void |
removeObjectWithIdentitcalKey(Collection<? extends PersistableBusinessObject> controlList,
PersistableBusinessObject bo)
Deprecated.
there is no replacement for this method
|
static BusinessObject |
retrieveObjectWithIdentitcalKey(Collection<? extends PersistableBusinessObject> controlList,
PersistableBusinessObject bo)
Deprecated.
there is no replacement for this method
|
static void |
setObjectProperty(Formatter formatter,
Object bo,
String propertyName,
Class type,
Object propertyValue)
Deprecated.
Sets the property of an object with the given value.
|
static void |
setObjectProperty(Object bo,
String propertyName,
Class propertyType,
Object propertyValue)
Deprecated.
Sets the property of an object with the given value.
|
static void |
setObjectProperty(Object bo,
String propertyName,
Object propertyValue)
Deprecated.
Sets the property of an object with the given value.
|
static void |
setObjectPropertyDeep(Object bo,
String propertyName,
Class type,
Object propertyValue)
Deprecated.
Recursive; sets all occurences of the property in the object, its nested objects and its object lists with the
given value.
|
static void |
setObjectPropertyDeep(Object bo,
String propertyName,
Class type,
Object propertyValue,
int depth)
Deprecated.
|
static byte[] |
toByteArray(Object object)
Deprecated.
Converts the object to a byte array using the output stream.
|
public static Serializable deepCopy(Serializable src)
src
- public static CopiedObject deepCopyForCaching(Serializable src)
src
- public static byte[] toByteArray(Object object) throws Exception
object
- Exception
public static Object fromByteArray(byte[] bytes) throws Exception
bytes
- Exception
public static String getMD5Hash(Object object) throws Exception
object
- Exception
public static BusinessObject createHybridBusinessObject(Class businessObjectClass, BusinessObject source, Map<String,String> template) throws FormatException, IllegalAccessException, InvocationTargetException, NoSuchMethodException
template
- a map defining the relationships between the fields of the newly created BO, and the source BO.
For each K (key), V (value)
entry, the value of property V on the source BO will be assigned to the K property of the newly created BONoSuchMethodException
InvocationTargetException
IllegalAccessException
FormatException
MaintenanceUtils
public static void createHybridBusinessObject(BusinessObject businessObject, BusinessObject source, Map<String,String> template) throws FormatException, IllegalAccessException, InvocationTargetException, NoSuchMethodException
public static Class easyGetPropertyType(Object object, String propertyName) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException
object
- An instance of the Class of which we're trying to get the property Class.propertyName
- The name of the property.IllegalAccessException
NoSuchMethodException
InvocationTargetException
@Deprecated public static Class getPropertyType(Object object, String propertyName, PersistenceStructureService persistenceStructureService)
object
- An instance of the Class for which we're trying to get the property type.propertyName
- The name of the property of the Class the Class of which we're trying to get. Dot notation is
used to separate properties.
TODO: The rules about this dot notation needs to be explained in Confluence using examples.persistenceStructureService
- Needed to get the type of elements in a Collection from OJB.@Deprecated public static Object getPropertyValue(Object businessObject, String propertyName)
DataObjectWrapper.getPropertyValueNullSafe(String)
insteadbusinessObject
- propertyName
- @Deprecated public static String getFormattedPropertyValue(BusinessObject businessObject, String propertyName, Formatter formatter)
businessObject
- BusinessObject instance that contains the propertypropertyName
- Name of property in BusinessObject to get value forformatter
- Default formatter to use (or null)public static String getFormattedPropertyValueUsingDataDictionary(BusinessObject businessObject, String propertyName)
businessObject
- BusinessObject instance that contains the propertypropertyName
- Name of property in BusinessObject to get value forpublic static String formatPropertyValue(Object propertyValue)
propertyValue
- Object value to be formattedpublic static void setObjectProperty(Object bo, String propertyName, Object propertyValue) throws FormatException, IllegalAccessException, InvocationTargetException, NoSuchMethodException
public static void setObjectProperty(Object bo, String propertyName, Class propertyType, Object propertyValue) throws FormatException, IllegalAccessException, InvocationTargetException, NoSuchMethodException
bo
- propertyName
- propertyType
- propertyValue
- NoSuchMethodException
InvocationTargetException
IllegalAccessException
FormatException
public static void setObjectProperty(Formatter formatter, Object bo, String propertyName, Class type, Object propertyValue) throws FormatException, IllegalAccessException, InvocationTargetException, NoSuchMethodException
formatter
- bo
- propertyName
- type
- propertyValue
- NoSuchMethodException
InvocationTargetException
IllegalAccessException
FormatException
@Deprecated public static Formatter getFormatterWithDataDictionary(Object bo, String propertyName)
bo
- - business object instance with property to get formatter forpropertyName
- - name of property to get formatter forpublic static void setObjectPropertyDeep(Object bo, String propertyName, Class type, Object propertyValue) throws FormatException, IllegalAccessException, InvocationTargetException, NoSuchMethodException
bo
- propertyName
- type
- propertyValue
- NoSuchMethodException
InvocationTargetException
IllegalAccessException
FormatException
public static void setObjectPropertyDeep(Object bo, String propertyName, Class type, Object propertyValue, int depth) throws FormatException, IllegalAccessException, InvocationTargetException, NoSuchMethodException
@Deprecated public static void materializeUpdateableCollections(Object bo) throws FormatException, IllegalAccessException, InvocationTargetException, NoSuchMethodException
DataObjectWrapper.materializeReferencedObjects(org.kuali.rice.krad.data.MaterializeOption...)
bo
- The business object for which you want unpdateable, proxied collections materializedFormatException
IllegalAccessException
InvocationTargetException
NoSuchMethodException
public static String clean(String string)
string
- @Deprecated public static boolean equalByKeys(PersistableBusinessObject bo1, PersistableBusinessObject bo2)
DataObjectWrapper.equalsByPrimaryKey(Object)
PersistableBusinessObject
instances for equality of type and key values.bo1
- bo2
- @Deprecated public static boolean collectionContainsObjectWithIdentitcalKey(Collection<? extends PersistableBusinessObject> controlList, PersistableBusinessObject bo)
PersistableBusinessObject
s to determine if an object with the
same key as the BO exists in the list.controlList
- - The list of items to checkbo
- - The BO whose keys we are looking for in the controlListpublic static int countObjectsWithIdentitcalKey(Collection<? extends PersistableBusinessObject> collection, PersistableBusinessObject bo)
PersistableBusinessObject
s to count how many have the
same key as the BO.collection
- - The collection of items to checkbo
- - The BO whose keys we are looking for in the collection@Deprecated public static void removeObjectWithIdentitcalKey(Collection<? extends PersistableBusinessObject> controlList, PersistableBusinessObject bo)
PersistableBusinessObject
s to determine if an object with the
same key as the BO exists in the list. If it
does, the item is removed from the List. This is functionally similar to List.remove() that operates only on Key
values.controlList
- - The list of items to checkbo
- - The BO whose keys we are looking for in the controlList@Deprecated public static BusinessObject retrieveObjectWithIdentitcalKey(Collection<? extends PersistableBusinessObject> controlList, PersistableBusinessObject bo)
controlList
- - The list of items to checkbo
- - The BO whose keys we are looking for in the controlListpublic static boolean isNestedAttribute(String attributeName)
attributeName
- public static String getNestedAttributePrefix(String attributeName)
attributeName
- public static String getNestedAttributePrimitive(String attributeName)
attributeName
- public static boolean isNull(Object object)
object
- - any object, proxied or not, materialized or notpublic static boolean isNotNull(Object object)
object
- - any object, proxied or not, materialized or notpublic static Class materializeClassForProxiedObject(Object object)
object
- the potentially proxied object to find the Class ofpublic static void materializeObjects(Collection possiblyProxiedObjects)
possiblyProxiedObjects
- - a Collection of objects that may be proxies@Deprecated public static void materializeSubObjectsToDepth(PersistableBusinessObject bo, int depth)
DataObjectWrapper.materializeReferencedObjectsToDepth(int, org.kuali.rice.krad.data.MaterializeOption...)
bo
- A valid, populated BusinessObject containing (possibly) proxied sub-objects. This object will be
modified in place.depth
- int Value 0-5 indicating how deep to recurse the materialization. If a zero (0) is passed in, then
no work will
be done.@Deprecated public static void materializeAllSubObjects(PersistableBusinessObject bo)
DataObjectWrapper.materializeReferencedObjectsToDepth(int, org.kuali.rice.krad.data.MaterializeOption...)
bo
- A valid, populated BusinessObject containing (possibly) proxied sub-objects. This object will be
modified in place.public static Object getNestedValue(Object bo, String fieldName)
bo
- fieldName
- public static Object createNewObjectFromClass(Class clazz)
ExternalizableBusinessObject
, this method will determine the interface for the EBO and
query the
appropriate module service to create a new instance.clazz
- public static boolean isWriteable(Object object, String property, PersistenceStructureService persistenceStructureService) throws IllegalArgumentException
object
- property
- IllegalArgumentException
public static <T> T newInstance(Class<T> clazz)
clazz
- - class of object to createpublic static List<Field> getAllFields(List<Field> fields, Class<?> type, Class<?> stopAt)
fields
- List of fields (public, private and protected)type
- Class from which fields retrieval has to startstopAt
- Parent class where the recursion should stopCopyright © 2005–2014 The Kuali Foundation. All rights reserved.