Class FieldReadHook

  • All Implemented Interfaces:
    Hook

    public class FieldReadHook
    extends Object
    implements Hook
    Configuration for field read instrumentation.
    • Method Detail

      • isEnabled

        public boolean isEnabled()
        Specified by:
        isEnabled in interface Hook
        Returns:
        whether enabled
      • getPriority

        public int getPriority()
        Description copied from interface: Hook
        Gets the priority for ordering multiple hooks at the same point.
        Specified by:
        getPriority in interface Hook
        Returns:
        the priority
      • isPassOwner

        public boolean isPassOwner()
        Returns:
        whether the field's owning object (null for static fields) is passed to the hook
      • isPassFieldName

        public boolean isPassFieldName()
        Returns:
        whether the field name is passed to the hook
      • isPassReadValue

        public boolean isPassReadValue()
        Returns:
        whether the value that was read (boxed if primitive) is passed to the hook
      • isInstrumentStatic

        public boolean isInstrumentStatic()
        Returns:
        whether static field reads are instrumented
      • isInstrumentInstance

        public boolean isInstrumentInstance()
        Returns:
        whether instance field reads are instrumented
      • simple

        public static FieldReadHook simple​(String hookOwner,
                                           String hookName,
                                           String hookDescriptor)
        Creates a field read hook that invokes the given static hook method.
        Parameters:
        hookOwner - the hook method's owning class (internal name)
        hookName - the hook method name
        hookDescriptor - the hook method descriptor
        Returns:
        the new hook
      • builder

        public static FieldReadHook.Builder builder()
        Creates a builder for a field read hook.
        Returns:
        a new builder