Class ObjectUtility

java.lang.Object
org.glassfish.pfl.test.ObjectUtility

public final class ObjectUtility extends Object
General object related utilities. This class must not depend on generated log wrappers.
  • Field Details

  • 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

      public static ObjectUtility make(boolean useToString, boolean isIndenting)
      Construct an Utility instance with the desired objectToString behavior.
    • make

      public static ObjectUtility make()
      Get the standard Utility object that supports objectToString with indented display and no use of toString() methods.
    • defaultObjectToString

      public 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.
    • compactObjectToString

      public static String compactObjectToString(Object object)
    • objectToString

      public String objectToString(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.
    • equals

      public static boolean equals(Object obj1, Object obj2)
    • concatenateArrays

      public 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. Throws IllegalArgumentException otherwise.
    • objectToStringHelper

      private void objectToStringHelper(IdentityHashMap printed, ObjectWriter result, Object obj)
    • mustUseToString

      private boolean mustUseToString(Class cls)
    • checkPackageAccess

      private void checkPackageAccess(Class cls)
    • getDeclaredFields

      private Field[] getDeclaredFields(Class cls)
    • handleObject

      private void handleObject(IdentityHashMap printed, ObjectWriter result, Object obj)
    • handleArray

      private void handleArray(IdentityHashMap printed, ObjectWriter result, Object obj)
    • equalsHelper

      private static boolean equalsHelper(Map counterpart, Set considered, Object obj1, Object obj2)
    • equalsObject

      private static boolean equalsObject(Map counterpart, Set considered, Class cls, Object obj1, Object obj2)
    • equalsObjectFields

      private static boolean equalsObjectFields(Map counterpart, Set considered, Class cls, Object obj1, Object obj2)
    • equalArrays

      private static boolean equalArrays(Map counterpart, Set considered, Object[] arr1, Object[] arr2)
    • equalMaps

      private static boolean equalMaps(Map counterpart, Set considered, Map map1, Map map2)
    • equalSets

      private static boolean equalSets(Map counterpart, Set considered, Set set1, Set set2)
    • equalLists

      private static boolean equalLists(Map counterpart, Set considered, List list1, List list2)
    • sop

      private static void sop(String msg)
    • displayException

      public static void displayException(Throwable thr)
    • 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

      public static void main(String[] args)