Class ObjectGraphWalker

java.lang.Object
org.ehcache.sizeof.ObjectGraphWalker

final class ObjectGraphWalker extends Object
This will walk an object graph and let you execute some "function" along the way
  • Field Details

  • Constructor Details

  • Method Details

    • getVerboseSizeOfDebugLogging

      private static boolean getVerboseSizeOfDebugLogging()
    • walk

      long walk(Object... root)
      Walk the graph and call into the "visitor"
      Parameters:
      root - the roots of the objects (a shared graph will only be visited once)
      Returns:
      the sum of all Visitor#visit returned values
    • walk

      long walk(VisitorListener visitorListener, Object... root)
      Walk the graph and call into the "visitor"
      Parameters:
      visitorListener - A decorator for the Visitor
      root - the roots of the objects (a shared graph will only be visited once)
      Returns:
      the sum of all Visitor#visit returned values
    • getFilteredFields

      private Collection<Field> getFilteredFields(Class<?> refClass)
      Returns the filtered fields for a particular type
      Parameters:
      refClass - the type
      Returns:
      A collection of fields to be visited
    • shouldWalkClass

      private boolean shouldWalkClass(Class<?> refClass)
    • nullSafeAdd

      private static void nullSafeAdd(Deque<Object> toVisit, Object o)
    • getAllFields

      private static Collection<Field> getAllFields(Class<?> refClass)
      Returns all non-primitive fields for the entire class hierarchy of a type
      Parameters:
      refClass - the type
      Returns:
      all fields for that type
    • byPassIfFlyweight

      private boolean byPassIfFlyweight(Object obj)