Class FieldWriteHook.Builder

  • Enclosing class:
    FieldWriteHook

    public static class FieldWriteHook.Builder
    extends Object
    Builder for FieldWriteHook, defaulting to enabled, priority 100, no values passed, and both static and instance writes instrumented.
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • hookDescriptor

        public FieldWriteHook.Builder hookDescriptor​(HookDescriptor hookDescriptor)
        Sets the method the instrumentation will call.
        Parameters:
        hookDescriptor - the hook method descriptor
        Returns:
        this builder
      • enabled

        public FieldWriteHook.Builder enabled​(boolean enabled)
        Sets whether the hook is applied at all.
        Parameters:
        enabled - whether the hook is active
        Returns:
        this builder
      • priority

        public FieldWriteHook.Builder priority​(int priority)
        Sets the ordering weight against other hooks on the same site.
        Parameters:
        priority - the priority value
        Returns:
        this builder
      • passOwner

        public FieldWriteHook.Builder passOwner​(boolean passOwner)
        Sets whether the owning object is passed to the hook.
        Parameters:
        passOwner - whether to pass the owner
        Returns:
        this builder
      • passFieldName

        public FieldWriteHook.Builder passFieldName​(boolean passFieldName)
        Sets whether the field name is passed to the hook.
        Parameters:
        passFieldName - whether to pass the field name
        Returns:
        this builder
      • passNewValue

        public FieldWriteHook.Builder passNewValue​(boolean passNewValue)
        Sets whether the value being written is passed to the hook.
        Parameters:
        passNewValue - whether to pass the new value
        Returns:
        this builder
      • passOldValue

        public FieldWriteHook.Builder passOldValue​(boolean passOldValue)
        Sets whether the previous field value is read and passed to the hook.
        Parameters:
        passOldValue - whether to pass the old value
        Returns:
        this builder
      • canModifyValue

        public FieldWriteHook.Builder canModifyValue​(boolean canModifyValue)
        Sets whether the hook's return value replaces the value written.
        Parameters:
        canModifyValue - whether the hook may substitute a value
        Returns:
        this builder
      • instrumentStatic

        public FieldWriteHook.Builder instrumentStatic​(boolean instrumentStatic)
        Sets whether PUTSTATIC sites are instrumented.
        Parameters:
        instrumentStatic - whether to instrument static writes
        Returns:
        this builder
      • instrumentInstance

        public FieldWriteHook.Builder instrumentInstance​(boolean instrumentInstance)
        Sets whether PUTFIELD sites are instrumented.
        Parameters:
        instrumentInstance - whether to instrument instance writes
        Returns:
        this builder