Interface ConstructorCallback<T>

  • Type Parameters:
    T - The class that will be sampled with this ConstructorCallback

    public interface ConstructorCallback<T>
    This interface describes a function that is used to sample a constructor. It is intended to be invoked every time a constructor for class T is invoked. This will not be invoked when subclasses of T are instantiated. This mechanism works independently of whether the class is part of the JDK core library.
    • Method Detail

      • sample

        void sample​(T newObj)
        When an object implementing interface ConstructorCallback is passed to ConstructorInstrumenter.instrumentClass(Class, ConstructorCallback), it will get executed whenever a constructor for type T is invoked.
        Parameters:
        newObj - the new Object whose construction we're recording. The object is not fully constructed; any references to this object that are stored in this callback are subject to the memory model constraints related to such objects.