Package org.glassfish.pfl.test
Class ObjectUtility
java.lang.Object
org.glassfish.pfl.test.ObjectUtility
General object related utilities. This class must not depend on
generated log wrappers.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static interface
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ObjectUtility.ClassMap
private ObjectUtility.ObjectPrinter
private static ObjectUtility
private int
private int
private boolean
private ObjectUtility.ObjectPrinter
private ObjectUtility.ObjectPrinter
private static ObjectUtility
private boolean
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
ObjectUtility
(boolean useToString, boolean isIndenting, int initialLevel, int increment) -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
a()
private static void
b()
private static void
c()
private void
checkPackageAccess
(Class cls) static String
compactObjectToString
(Object object) static Object
concatenateArrays
(Object arr1, Object arr2) If arr1 and arr2 are both arrays of the same component type, return an array of that component type that consists of the elements of arr1 followed by the elements of arr2.private static void
d()
static String
defaultObjectToString
(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.static void
private static void
e()
private static boolean
equalArrays
(Map counterpart, Set considered, Object[] arr1, Object[] arr2) private static boolean
equalLists
(Map counterpart, Set considered, List list1, List list2) private static boolean
static boolean
private static boolean
private static boolean
equalsHelper
(Map counterpart, Set considered, Object obj1, Object obj2) private static boolean
private static boolean
private Field[]
getDeclaredFields
(Class cls) private void
handleArray
(IdentityHashMap printed, ObjectWriter result, Object obj) private void
handleObject
(IdentityHashMap printed, ObjectWriter result, Object obj) static void
static ObjectUtility
make()
Get the standard Utility object that supports objectToString with indented display and no use of toString() methods.static ObjectUtility
make
(boolean useToString, boolean isIndenting) Construct an Utility instance with the desired objectToString behavior.static ObjectUtility
make
(boolean useToString, boolean isIndenting, int initialLevel, int increment) Construct an Utility instance with the desired objectToString behavior.private boolean
mustUseToString
(Class cls) objectToString
(Object obj) objectToString handles display of arbitrary objects.private void
objectToStringHelper
(IdentityHashMap printed, ObjectWriter result, Object obj) private static void
-
Field Details
-
useToString
private boolean useToString -
isIndenting
private boolean isIndenting -
initialLevel
private int initialLevel -
increment
private int increment -
classToPrinter
-
standard
-
compact
-
propertiesPrinter
-
collectionPrinter
-
mapPrinter
-
-
Constructor Details
-
ObjectUtility
private ObjectUtility(boolean useToString, boolean isIndenting, int initialLevel, int increment)
-
-
Method Details
-
make
public static ObjectUtility make(boolean useToString, boolean isIndenting, int initialLevel, int increment) Construct an Utility instance with the desired objectToString behavior. -
make
Construct an Utility instance with the desired objectToString behavior. -
make
Get the standard Utility object that supports objectToString with indented display and no use of toString() methods. -
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. -
compactObjectToString
-
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. -
equals
-
concatenateArrays
If arr1 and arr2 are both arrays of the same component type, return an array of that component type that consists of the elements of arr1 followed by the elements of arr2. Throws IllegalArgumentException otherwise. -
objectToStringHelper
-
mustUseToString
-
checkPackageAccess
-
getDeclaredFields
-
handleObject
-
handleArray
-
equalsHelper
-
equalsObject
-
equalsObjectFields
-
equalArrays
-
equalMaps
-
equalSets
-
equalLists
-
sop
-
displayException
-
a
private static void a() -
b
private static void b() -
c
private static void c() -
d
private static void d() -
e
private static void e() -
main
-