Class Heaplets


  • public final class Heaplets
    extends Object
    Loads Heaplet classes based on the class of object they create. Three methods of locating the heaplet class are attempted, in the following order:
    1. The Loader class attempts to locate a HeapletFactory interface implementation suitable for the class being created.
    2. A nested Heaplet class is searched for. Example: creating com.example.Foo would search for a heaplet class named com.example.Foo$Heaplet.
    3. A standalone class with the name Heaplet appended. Example: creating com.example.Foo would search for a heaplet class named com.example.FooHeaplet.
    • Method Detail

      • getHeaplet

        public static Heaplet getHeaplet​(Class<?> c)
        Returns the heaplet that creates an instance of the specified class, or null if no such heaplet could be found.
        Parameters:
        c - the class that the heaplet is responsible for creating.
        Returns:
        the heaplet that creates the specified class, or null if not found.
      • findHeapletClass

        public static Optional<Class<? extends Heaplet>> findHeapletClass​(Class<?> c)
        Finds the heaplet class associated to the given c type.
        Parameters:
        c - type to find a heaplet for
        Returns:
        an optional containing the heaplet class (if found), otherwise empty.