Class ObjectUtility
- java.lang.Object
-
- org.glassfish.pfl.basic.algorithm.ObjectUtility
-
public final class ObjectUtility extends java.lang.Object
General object related utilities.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ObjectUtility.ClassMap
(package private) static interface
ObjectUtility.ObjectPrinter
-
Field Summary
Fields Modifier and Type Field Description private ObjectUtility.ObjectPrinter
arrayPrinter
private java.lang.Object[][]
CLASS_MAP_DATA
private ObjectUtility.ClassMap
classMap
private ObjectUtility.ObjectPrinter
collectionPrinter
private static ObjectUtility
compact
private ObjectUtility.ObjectPrinter
generalObjectPrinter
private int
increment
private int
initialLevel
private boolean
isIndenting
private ObjectUtility.ObjectPrinter
mapPrinter
private static ObjectUtility.ObjectPrinter
propertiesPrinter
private static ObjectUtility
standard
private static ObjectUtility.ObjectPrinter
toStringPrinter
-
Constructor Summary
Constructors Constructor Description ObjectUtility(boolean isIndenting, int initialLevel, int increment)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkPackageAccess(java.lang.Class cls)
(package private) ObjectUtility.ObjectPrinter
classify(java.lang.Class cls)
static java.lang.String
compactObjectToString(java.lang.Object object)
A convenience method that gives the default behavior: do not use indenting to display the object's structure.static java.lang.String
defaultObjectToString(java.lang.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.private java.lang.reflect.Field[]
getDeclaredFields(java.lang.Class cls)
private void
handleArray(java.util.IdentityHashMap printed, ObjectWriter result, java.lang.Object obj)
private void
handleObject(java.util.IdentityHashMap printed, ObjectWriter result, java.lang.Object obj)
java.lang.String
objectToString(java.lang.Object obj)
objectToString handles display of arbitrary objects.private void
objectToStringHelper(java.util.IdentityHashMap printed, ObjectWriter result, java.lang.Object obj)
ObjectUtility
useToString(java.lang.Class cls)
-
-
-
Field Detail
-
generalObjectPrinter
private ObjectUtility.ObjectPrinter generalObjectPrinter
-
arrayPrinter
private ObjectUtility.ObjectPrinter arrayPrinter
-
propertiesPrinter
private static ObjectUtility.ObjectPrinter propertiesPrinter
-
collectionPrinter
private ObjectUtility.ObjectPrinter collectionPrinter
-
mapPrinter
private ObjectUtility.ObjectPrinter mapPrinter
-
toStringPrinter
private static ObjectUtility.ObjectPrinter toStringPrinter
-
CLASS_MAP_DATA
private final java.lang.Object[][] CLASS_MAP_DATA
-
classMap
private ObjectUtility.ClassMap classMap
-
isIndenting
private boolean isIndenting
-
initialLevel
private int initialLevel
-
increment
private int increment
-
standard
private static ObjectUtility standard
-
compact
private static ObjectUtility compact
-
-
Method Detail
-
useToString
public ObjectUtility useToString(java.lang.Class cls)
-
defaultObjectToString
public static java.lang.String defaultObjectToString(java.lang.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.- Parameters:
object
- Object to print.- Returns:
- the String representation of obj.
-
compactObjectToString
public static java.lang.String compactObjectToString(java.lang.Object object)
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
public java.lang.String objectToString(java.lang.Object obj)
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.
-
classify
ObjectUtility.ObjectPrinter classify(java.lang.Class cls)
-
objectToStringHelper
private void objectToStringHelper(java.util.IdentityHashMap printed, ObjectWriter result, java.lang.Object obj)
-
checkPackageAccess
private void checkPackageAccess(java.lang.Class cls)
-
getDeclaredFields
private java.lang.reflect.Field[] getDeclaredFields(java.lang.Class cls)
-
handleObject
private void handleObject(java.util.IdentityHashMap printed, ObjectWriter result, java.lang.Object obj)
-
handleArray
private void handleArray(java.util.IdentityHashMap printed, ObjectWriter result, java.lang.Object obj)
-
-