Class ObjectUtility

java.lang.Object
org.glassfish.pfl.basic.algorithm.ObjectUtility

public final class ObjectUtility extends Object
General object related utilities.
  • Field Details

  • Constructor Details

    • ObjectUtility

      public ObjectUtility(boolean isIndenting, int initialLevel, int increment)
  • Method Details

    • useToString

      public ObjectUtility useToString(Class cls)
    • 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.
      Parameters:
      object - Object to print.
      Returns:
      the String representation of obj.
    • compactObjectToString

      public static String compactObjectToString(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 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.
    • classify

    • objectToStringHelper

      private void objectToStringHelper(IdentityHashMap printed, ObjectWriter result, Object obj)
    • 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)