Class FieldWriteHook

  • All Implemented Interfaces:
    Hook

    public class FieldWriteHook
    extends Object
    implements Hook
    Configuration for field write 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
      • isPassNewValue

        public boolean isPassNewValue()
        Returns:
        whether the new value being written (boxed if primitive) is passed to the hook
      • isPassOldValue

        public boolean isPassOldValue()
        Returns:
        whether the old value (requires an additional load) is passed to the hook
      • isCanModifyValue

        public boolean isCanModifyValue()
        Returns:
        whether the hook can replace the value being written (by returning a new one)
      • isInstrumentStatic

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

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

        public static FieldWriteHook simple​(String hookOwner,
                                            String hookName,
                                            String hookDescriptor)
        Creates a hook with default settings that calls a static method.
        Parameters:
        hookOwner - internal name of the class declaring the hook method
        hookName - the hook method name
        hookDescriptor - the hook method descriptor
        Returns:
        the configured hook