Class Instruments


  • public class Instruments
    extends Object
    The Class Instruments.
    • Field Detail

      • SIZE_BOOLEAN

        public static final long SIZE_BOOLEAN
        The Constant SIZE_BOOLEAN.
        See Also:
        Constant Field Values
      • SIZE_SHORT

        public static final long SIZE_SHORT
        The Constant SIZE_SHORT.
        See Also:
        Constant Field Values
      • SIZE_FLOAT

        public static final long SIZE_FLOAT
        The Constant SIZE_FLOAT.
        See Also:
        Constant Field Values
      • SIZE_DOUBLE

        public static final long SIZE_DOUBLE
        The Constant SIZE_DOUBLE.
        See Also:
        Constant Field Values
      • SIZE_OBJECT

        public static final long SIZE_OBJECT
        The Constant SIZE_OBJECT.
        See Also:
        Constant Field Values
      • SIZE_REFERENCE

        public static final long SIZE_REFERENCE
        The Constant SIZE_REFERENCE.
      • ACCESSOR

        private static final Accessor ACCESSOR
        The Constant ACCESSOR.
      • IGNORE_NIO

        private static final boolean IGNORE_NIO
        The Constant IGNORE_NIO.
      • processedObjects

        private Set<Object> processedObjects
        The processed objects.
      • thisQueue

        private final List<Object> thisQueue
        The this queue.
      • nextQueue

        private final List<Object> nextQueue
        The next queue.
      • classLoader

        private ClassLoader classLoader
        The class loader.
    • Constructor Detail

      • Instruments

        public Instruments()
    • Method Detail

      • sizeOf

        public static long sizeOf​(Object obj)
        Size of.
        Parameters:
        obj - the obj
        Returns:
        the long
      • sizeOf

        public static long sizeOf​(Object obj,
                                  ClassLoader cl)
        Size of.
        Parameters:
        obj - the obj
        cl - the cl
        Returns:
        the long
      • sizeOf

        public static long sizeOf​(Object obj,
                                  Set<Object> objects)
        Size of.
        Parameters:
        obj - the obj
        objects - the objects
        Returns:
        the long
      • internalSizeOf

        private long internalSizeOf​(Object root)
        Internal size of.
        Parameters:
        root - the root
        Returns:
        the long
      • sizeOfObject

        private long sizeOfObject​(Object obj)
        Size of object.
        Parameters:
        obj - the obj
        Returns:
        the long
      • sizeOfArray

        private long sizeOfArray​(Object obj)
        Size of array.
        Parameters:
        obj - the obj
        Returns:
        the long
      • sizeOfPrimitive

        private static <T> long sizeOfPrimitive​(Class<T> type)
        Size of primitive.
        Type Parameters:
        T - the generic type
        Parameters:
        type - the type
        Returns:
        the long
      • isInitialized

        public static boolean isInitialized()
        Checks if is initialized.
        Returns:
        true, if is initialized
      • getField

        public static Object getField​(Object obj,
                                      String name)
        Gets the field.
        Parameters:
        obj - the obj
        name - the name
        Returns:
        the field
      • findField

        public static <T> Field findField​(Class<T> clazz,
                                          String name)
        Find field.
        Type Parameters:
        T - the generic type
        Parameters:
        clazz - the clazz
        name - the name
        Returns:
        the field