Class ObjectUtility
java.lang.Object
org.glassfish.pfl.basic.algorithm.ObjectUtility
General object related utilities.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcompactObjectToString(Object object) A convenience method that gives the default behavior: do not use indenting to display the object's structure.static StringdefaultObjectToString(Object object) A convenience method that gives the default behavior: use indenting to display the object's structure and do not use built-in toString methods.objectToString(Object obj) objectToString handles display of arbitrary objects.useToString(Class cls)
-
Constructor Details
-
ObjectUtility
public ObjectUtility(boolean isIndenting, int initialLevel, int increment)
-
-
Method Details
-
useToString
-
defaultObjectToString
A convenience method that gives the default behavior: use indenting to display the object's structure and do not use built-in toString methods.- Parameters:
object- Object to print.- Returns:
- the String representation of obj.
-
compactObjectToString
A convenience method that gives the default behavior: do not use indenting to display the object's structure.- Parameters:
object- Object to print.- Returns:
- the String representation of obj.
-
objectToString
objectToString handles display of arbitrary objects. It correctly handles objects whose elements form an arbitrary graph. It uses reflection to display the contents of any kind of object. An object's toString() method may optionally be used, but the default is to ignore all toString() methods except for those defined for primitive types, primitive type wrappers, and strings.
-