Java Doc for ObjectUtils.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » core » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ERP CRM Financial » Kuali Financial System » org.kuali.core.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.kuali.core.util.ObjectUtils

ObjectUtils
public class ObjectUtils (Code)
This class contains various Object, Proxy, and serialization utilities.




Method Summary
public static  Stringclean(String string)
     Removes all query characters from a string.
public static  booleancollectionContainsObjectWithIdentitcalKey(Collection controlList, BusinessObject bo)
     Compares a business object with a List of BOs to determine if an object with the same key as the BO exists in the list.
public static  intcountObjectsWithIdentitcalKey(Collection<? extends BusinessObject> collection, BusinessObject bo)
     Compares a business object with a Collection of BOs to count how many have the same key as the BO.
public static  BusinessObjectcreateHybridBusinessObject(Class businessObjectClass, BusinessObject source, Map<String, String> template)
     Creates a new instance of a given BusinessObject, copying fields specified in template from the given source BO.
public static  ObjectcreateNewObjectFromClass(Class clazz)
    
public static  SerializabledeepCopy(Serializable src)
     Uses Serialization mechanism to create a deep copy of the given Object.
public static  CopiedObjectdeepCopyForCaching(Serializable src)
     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.
public static  ClasseasyGetPropertyType(Object object, String propertyName)
     This method simply uses PojoPropertyUtilsBean logic to get the Class of a Class property.
public static  booleanequalByKeys(BusinessObject bo1, BusinessObject bo2)
     Compares two business objects for equality of type and key values.
public static  ObjectfromByteArray(byte[] bytes)
    
public static  StringgetMD5Hash(Object object)
    
public static  StringgetNestedAttributePrefix(String attributeName)
     Returns the prefix of a nested attribute name, or the empty string if the attribute name is not nested.
public static  StringgetNestedAttributePrimitive(String attributeName)
     Returns the primitive part of an attribute name string.
public static  ObjectgetNestedValue(BusinessObject bo, String fieldName)
     This method safely extracts either simple values OR nested values.
public static  ClassgetPropertyType(Object object, String propertyName, PersistenceStructureService persistenceStructureService)
     Returns the type of the property in the object.
public static  ObjectgetPropertyValue(Object businessObject, String propertyName)
     Returns the value of the property in the object.
public static  booleanisNestedAttribute(String attributeName)
     Determines if a given string could represent a nested attribute of an object.
public static  booleanisNotNull(Object object)
     This method is a OJB Proxy-safe way to test for notNull on a proxied object that may or may not be materialized yet.
public static  booleanisNull(Object object)
     This method is a OJB Proxy-safe way to test for null on a proxied object that may or may not be materialized yet.
public static  voidmaterializeAllSubObjects(PersistableBusinessObject bo)
     This method attempts to materialize all of the proxied reference objects (ie, sub-objects) hanging off the passed-in BO object.
public static  voidmaterializeObjects(Collection possiblyProxiedObjects)
     This method runs the ObjectUtils.isNotNull() method for each item in a list of BOs.
public static  voidmaterializeSubObjectsToDepth(PersistableBusinessObject bo, int depth)
     This method attempts to materialize all of the proxied reference objects (ie, sub-objects) hanging off the passed-in BO object.
public static  voidmaterializeUpdateableCollections(Object bo)
    
public static  booleannullSafeEquals(Object obj1, Object obj2)
     Returns the equality of the two given objects, automatically handling when one or both of the objects is null.
public static  voidremoveObjectWithIdentitcalKey(Collection controlList, BusinessObject bo)
     Compares a business object with a List of BOs to determine if an object with the same key as the BO exists in the list.
public static  BusinessObjectretrieveObjectWithIdentitcalKey(Collection controlList, BusinessObject bo)
     Compares a business object with a List of BOs to determine if an object with the same key as the BO exists in the list.
public static  voidsetObjectProperty(Object bo, String propertyName, Object propertyValue)
     Sets the property of an object with the given value.
public static  voidsetObjectProperty(Object bo, String propertyName, Class propertyType, Object propertyValue)
     Sets the property of an object with the given value.
public static  voidsetObjectProperty(Formatter formatter, Object bo, String propertyName, Class type, Object propertyValue)
     Sets the property of an object with the given value.
public static  voidsetObjectPropertyDeep(Object bo, String propertyName, Class type, Object propertyValue)
     Recursive; sets all occurences of the property in the object, its nested objects and its object lists with the given value.
public static  voidsetObjectPropertyDeep(Object bo, String propertyName, Class type, Object propertyValue, int depth)
    
public static  byte[]toByteArray(Object object)
     Converts the object to a byte array using the output stream.



Method Detail
clean
public static String clean(String string)(Code)
Removes all query characters from a string.
Parameters:
  string - Cleaned string



collectionContainsObjectWithIdentitcalKey
public static boolean collectionContainsObjectWithIdentitcalKey(Collection controlList, BusinessObject bo)(Code)
Compares a business object with a List of BOs to determine if an object with the same key as the BO exists in the list.
Parameters:
  controlList - - The list of items to check
Parameters:
  bo - - The BO whose keys we are looking for in the controlList boolean



countObjectsWithIdentitcalKey
public static int countObjectsWithIdentitcalKey(Collection<? extends BusinessObject> collection, BusinessObject bo)(Code)
Compares a business object with a Collection of BOs to count how many have the same key as the BO.
Parameters:
  collection - - The collection of items to check
Parameters:
  bo - - The BO whose keys we are looking for in the collection how many have the same keys



createHybridBusinessObject
public static BusinessObject createHybridBusinessObject(Class businessObjectClass, BusinessObject source, Map<String, String> template) throws FormatException, IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code)
Creates a new instance of a given BusinessObject, copying fields specified in template from the given source BO. For example, this can be used to create an AccountChangeDetail based on a particular Account.
Parameters:
  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 BO
See Also:   org.kuali.core.maintenance.util.MaintenanceUtils
throws:
  NoSuchMethodException -
throws:
  InvocationTargetException -
throws:
  IllegalAccessException -
throws:
  FormatException -



createNewObjectFromClass
public static Object createNewObjectFromClass(Class clazz)(Code)
This method safely creates a object from a class Convenience method to create new object and throw a runtime exception if it cannot
Parameters:
  boClass - a newInstance() of clazz



deepCopy
public static Serializable deepCopy(Serializable src)(Code)
Uses Serialization mechanism to create a deep copy of the given Object. As a special case, deepCopy of null returns null, just to make using this method simpler. For a detailed discussion see: http://www.javaworld.com/javaworld/javatips/jw-javatip76.html
Parameters:
  src - deep copy of the given Serializable



deepCopyForCaching
public static CopiedObject deepCopyForCaching(Serializable src)(Code)
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. As a special case, deepCopy of null returns a cacheableObject containing null and a size of 0, to make using this method simpler. For a detailed discussion see: http://www.javaworld.com/javaworld/javatips/jw-javatip76.html
Parameters:
  src - CopiedObject containing a deep copy of the given Serializable and its size in bytes



easyGetPropertyType
public static Class easyGetPropertyType(Object object, String propertyName) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException(Code)
This method simply uses PojoPropertyUtilsBean logic to get the Class of a Class property. This method does not have any of the logic needed to obtain the Class of an element of a Collection specified in the DataDictionary.
Parameters:
  object - An instance of the Class of which we're trying to get the property Class.
Parameters:
  propertyName - The name of the property.
throws:
  IllegalAccessException -
throws:
  NoSuchMethodException -
throws:
  InvocationTargetException -



equalByKeys
public static boolean equalByKeys(BusinessObject bo1, BusinessObject bo2)(Code)
Compares two business objects for equality of type and key values.
Parameters:
  bo1 -
Parameters:
  bo2 - boolean indicating whether the two objects are equal.



fromByteArray
public static Object fromByteArray(byte[] bytes) throws Exception(Code)
reconsitiutes the object that was converted into a byte array by toByteArray
Parameters:
  bytes -
throws:
  Exception -



getMD5Hash
public static String getMD5Hash(Object object) throws Exception(Code)
use MD5 to create a one way hash of an object
Parameters:
  object -



getNestedAttributePrefix
public static String getNestedAttributePrefix(String attributeName)(Code)
Returns the prefix of a nested attribute name, or the empty string if the attribute name is not nested.
Parameters:
  attributeName - everything BEFORE the last "." character in attributeName



getNestedAttributePrimitive
public static String getNestedAttributePrimitive(String attributeName)(Code)
Returns the primitive part of an attribute name string.
Parameters:
  attributeName - everything AFTER the last "." character in attributeName



getNestedValue
public static Object getNestedValue(BusinessObject bo, String fieldName)(Code)
This method safely extracts either simple values OR nested values. For example, if the bo is SubAccount, and the fieldName is a21SubAccount.subAccountTypeCode, this thing makes sure it gets the value off the very end attribute, no matter how deeply nested it is. The code would be slightly simpler if this was done recursively, but this is safer, and consumes a constant amount of memory, no matter how deeply nested it goes.
Parameters:
  bo -
Parameters:
  fieldName - The field value if it exists. If it doesnt, and the name is invalid, and



getPropertyType
public static Class getPropertyType(Object object, String propertyName, PersistenceStructureService persistenceStructureService)(Code)
Returns the type of the property in the object. This implementation is not smart enough to look through a Collection to get the property type of an attribute of an element in the collection. NOTE: A patch file attached to https://test.kuali.org/jira/browse/KULRNE-4435 contains a modified version of this method which IS smart enough to look through Collections. This patch is currently under review.
Parameters:
  object - An instance of the Class for which we're trying to get the property type.
Parameters:
  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.
Parameters:
  persistenceStructureService - Needed to get the type of elements in a Collection from OJB. Object will be null if any parent property for the given property is null.



getPropertyValue
public static Object getPropertyValue(Object businessObject, String propertyName)(Code)
Returns the value of the property in the object.
Parameters:
  businessObject -
Parameters:
  propertyName - Object will be null if any parent property for the given property is null.



isNestedAttribute
public static boolean isNestedAttribute(String attributeName)(Code)
Determines if a given string could represent a nested attribute of an object.
Parameters:
  attributeName - true if the attribute is nested



isNotNull
public static boolean isNotNull(Object object)(Code)
This method is a OJB Proxy-safe way to test for notNull on a proxied object that may or may not be materialized yet. It is safe to use on a proxy (materialized or non-materialized) or on a non-proxy (ie, regular object). Note that this will force a materialization of the proxy if the object is a proxy and unmaterialized.
Parameters:
  object - - any object, proxied or not, materialized or not true if the object (or underlying materialized object) is not null, true if its null



isNull
public static boolean isNull(Object object)(Code)
This method is a OJB Proxy-safe way to test for null on a proxied object that may or may not be materialized yet. It is safe to use on a proxy (materialized or non-materialized) or on a non-proxy (ie, regular object). Note that this will force a materialization of the proxy if the object is a proxy and unmaterialized.
Parameters:
  object - - any object, proxied or not, materialized or not true if the object (or underlying materialized object) is null, false otherwise



materializeAllSubObjects
public static void materializeAllSubObjects(PersistableBusinessObject bo)(Code)
This method attempts to materialize all of the proxied reference objects (ie, sub-objects) hanging off the passed-in BO object. It will do it just three levels down. In other words, it will only materialize the objects that are direct members of the bo, objects that are direct members of those bos, that one more time, and no further down. An IllegalArgumentException will be thrown if the bo object passed in is itself a non-materialized proxy object. If the bo passed in has no proxied sub-objects, then the object will not be modified, and no errors will be thrown.
Parameters:
  bo - A valid, populated BusinessObject containing (possibly) proxied sub-objects. This object will be modified in place.



materializeObjects
public static void materializeObjects(Collection possiblyProxiedObjects)(Code)
This method runs the ObjectUtils.isNotNull() method for each item in a list of BOs. ObjectUtils.isNotNull() will materialize the objects if they are currently OJB proxies.
Parameters:
  possiblyProxiedObjects - - a Collection of objects that may be proxies



materializeSubObjectsToDepth
public static void materializeSubObjectsToDepth(PersistableBusinessObject bo, int depth)(Code)
This method attempts to materialize all of the proxied reference objects (ie, sub-objects) hanging off the passed-in BO object. It will do it down to the specified depth. An IllegalArgumentException will be thrown if the bo object passed in is itself a non-materialized proxy object. If the bo passed in has no proxied sub-objects, then the object will not be modified, and no errors will be thrown. WARNING: Be careful using depth any greater than 2. The number of DB hits, time, and memory consumed grows exponentially with each additional increment to depth. Make sure you really need that depth before doing so.
Parameters:
  bo - A valid, populated BusinessObject containing (possibly) proxied sub-objects. This object will be modified in place.
Parameters:
  depth - int Value 0-5 indicating how deep to recurse the materialization. If a zero (0) is passed in, then no work willbe done.



materializeUpdateableCollections
public static void materializeUpdateableCollections(Object bo) throws FormatException, IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code)
This method checks for updateable collections on the business object provided and materializes the corresponding collection proxies
Parameters:
  bo - The business object for which you want unpdateable, proxied collections materialized
throws:
  FormatException -
throws:
  IllegalAccessException -
throws:
  InvocationTargetException -
throws:
  NoSuchMethodException -



nullSafeEquals
public static boolean nullSafeEquals(Object obj1, Object obj2)(Code)
Returns the equality of the two given objects, automatically handling when one or both of the objects is null.
Parameters:
  obj1 -
Parameters:
  obj2 - true if both objects are null or both are equal



removeObjectWithIdentitcalKey
public static void removeObjectWithIdentitcalKey(Collection controlList, BusinessObject bo)(Code)
Compares a business object with a List of BOs 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.
Parameters:
  controlList - - The list of items to check
Parameters:
  bo - - The BO whose keys we are looking for in the controlList



retrieveObjectWithIdentitcalKey
public static BusinessObject retrieveObjectWithIdentitcalKey(Collection controlList, BusinessObject bo)(Code)
Compares a business object with a List of BOs to determine if an object with the same key as the BO exists in the list. If it does, the item is returned.
Parameters:
  controlList - - The list of items to check
Parameters:
  bo - - The BO whose keys we are looking for in the controlList



setObjectProperty
public static void setObjectProperty(Object bo, String propertyName, Object propertyValue) throws FormatException, IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code)
Sets the property of an object with the given value. Converts using the formatter of the type for the property. Note: propertyType does not need passed, is found by util method.



setObjectProperty
public static void setObjectProperty(Object bo, String propertyName, Class propertyType, Object propertyValue) throws FormatException, IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code)
Sets the property of an object with the given value. Converts using the formatter of the given type if one is found.
Parameters:
  bo -
Parameters:
  propertyName -
Parameters:
  propertyType -
Parameters:
  propertyValue -
throws:
  NoSuchMethodException -
throws:
  InvocationTargetException -
throws:
  IllegalAccessException -



setObjectProperty
public static void setObjectProperty(Formatter formatter, Object bo, String propertyName, Class type, Object propertyValue) throws FormatException, IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code)
Sets the property of an object with the given value. Converts using the given formatter, if it isn't null.
Parameters:
  formatter -
Parameters:
  bo -
Parameters:
  propertyName -
Parameters:
  type -
Parameters:
  propertyValue -
throws:
  NoSuchMethodException -
throws:
  InvocationTargetException -
throws:
  IllegalAccessException -



setObjectPropertyDeep
public static void setObjectPropertyDeep(Object bo, String propertyName, Class type, Object propertyValue) throws FormatException, IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code)
Recursive; sets all occurences of the property in the object, its nested objects and its object lists with the given value.
Parameters:
  bo -
Parameters:
  propertyName -
Parameters:
  type -
Parameters:
  propertyValue -
throws:
  NoSuchMethodException -
throws:
  InvocationTargetException -
throws:
  IllegalAccessException -



setObjectPropertyDeep
public static void setObjectPropertyDeep(Object bo, String propertyName, Class type, Object propertyValue, int depth) throws FormatException, IllegalAccessException, InvocationTargetException, NoSuchMethodException(Code)



toByteArray
public static byte[] toByteArray(Object object) throws Exception(Code)
Converts the object to a byte array using the output stream.
Parameters:
  object - byte array of the object



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.