Class Instrumenter.FieldWriteHookBuilder
- java.lang.Object
-
- com.tonic.analysis.instrumentation.Instrumenter.FieldWriteHookBuilder
-
- Enclosing class:
- Instrumenter
public static class Instrumenter.FieldWriteHookBuilder extends Object
Fluent builder for a field write hook.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Instrumenter.FieldWriteHookBuilderallowModification()Lets the hook replace the value written.Instrumenter.FieldWriteHookBuildercallStatic(String owner, String name, String descriptor)Sets the static method the hook dispatches to.Instrumenter.FieldWriteHookBuilderforField(String fieldName)Restricts this hook to one field name.Instrumenter.FieldWriteHookBuilderforFieldsMatching(String pattern)Restricts this hook to fields whose name matches a pattern.Instrumenter.FieldWriteHookBuilderinClass(String className)Restricts this hook to a single class.Instrumenter.FieldWriteHookBuilderinPackage(String packagePrefix)Restricts this hook to classes under a package.Instrumenter.FieldWriteHookBuilderinstanceOnly()Instruments instance field writes only.Instrumenter.FieldWriteHookBuilderofType(String descriptor)Restricts this hook to fields of one type.Instrumenter.FieldWriteHookBuilderpriority(int priority)Sets the ordering priority of this hook against others at the same site.Instrumenterregister()Attaches the collected filters and registers the hook.Instrumenter.FieldWriteHookBuilderstaticOnly()Instruments static field writes only.Instrumenter.FieldWriteHookBuilderwithFieldName()Passes the field name as a hook argument.Instrumenter.FieldWriteHookBuilderwithNewValue()Passes the value being written as a hook argument.Instrumenter.FieldWriteHookBuilderwithOldValue()Passes the field's prior value as a hook argument.Instrumenter.FieldWriteHookBuilderwithOwner()Passes the field owner as a hook argument.
-
-
-
Method Detail
-
inClass
public Instrumenter.FieldWriteHookBuilder inClass(String className)
Restricts this hook to a single class.- Parameters:
className- the internal class name- Returns:
- this builder
-
inPackage
public Instrumenter.FieldWriteHookBuilder inPackage(String packagePrefix)
Restricts this hook to classes under a package.- Parameters:
packagePrefix- the internal package name prefix- Returns:
- this builder
-
forField
public Instrumenter.FieldWriteHookBuilder forField(String fieldName)
Restricts this hook to one field name.- Parameters:
fieldName- the field name- Returns:
- this builder
-
forFieldsMatching
public Instrumenter.FieldWriteHookBuilder forFieldsMatching(String pattern)
Restricts this hook to fields whose name matches a pattern.- Parameters:
pattern- the field name pattern- Returns:
- this builder
-
ofType
public Instrumenter.FieldWriteHookBuilder ofType(String descriptor)
Restricts this hook to fields of one type.- Parameters:
descriptor- the field descriptor- Returns:
- this builder
-
staticOnly
public Instrumenter.FieldWriteHookBuilder staticOnly()
Instruments static field writes only.- Returns:
- this builder
-
instanceOnly
public Instrumenter.FieldWriteHookBuilder instanceOnly()
Instruments instance field writes only.- Returns:
- this builder
-
callStatic
public Instrumenter.FieldWriteHookBuilder callStatic(String owner, String name, String descriptor)
Sets the static method the hook dispatches to.- Parameters:
owner- internal name of the class declaring the hook methodname- the hook method namedescriptor- the hook method descriptor- Returns:
- this builder
-
withOwner
public Instrumenter.FieldWriteHookBuilder withOwner()
Passes the field owner as a hook argument.- Returns:
- this builder
-
withFieldName
public Instrumenter.FieldWriteHookBuilder withFieldName()
Passes the field name as a hook argument.- Returns:
- this builder
-
withNewValue
public Instrumenter.FieldWriteHookBuilder withNewValue()
Passes the value being written as a hook argument.- Returns:
- this builder
-
withOldValue
public Instrumenter.FieldWriteHookBuilder withOldValue()
Passes the field's prior value as a hook argument.- Returns:
- this builder
-
allowModification
public Instrumenter.FieldWriteHookBuilder allowModification()
Lets the hook replace the value written.- Returns:
- this builder
-
priority
public Instrumenter.FieldWriteHookBuilder priority(int priority)
Sets the ordering priority of this hook against others at the same site.- Parameters:
priority- the priority value- Returns:
- this builder
-
register
public Instrumenter register()
Attaches the collected filters and registers the hook.- Returns:
- the instrumenter this builder came from
-
-