Package org.jboss.byteman.agent
Class TransformContext
- java.lang.Object
-
- org.jboss.byteman.agent.TransformContext
-
public class TransformContext extends Object
Class used to localise the context information employed when creating a rule from a rule script and using it to transform a method
-
-
Constructor Summary
Constructors Constructor Description TransformContext(Transformer transformer, RuleScript ruleScript, String triggerClassName, ClassLoader loader, HelperManager helperManager, AccessEnabler accessEnabler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RulecreateRule(String triggerMethodName, String triggerMethodDescriptor)called by a check adapter to create a rule specific to a given trigger method.voidfail(String failMessage, String triggerMethodName, String triggerMethodDescriptor)called by a check or trigger adapter to fail a transform because of a type issue.StringfindLeastCommonSuper(String t1, String t2)StringgetTriggerClassName()booleaninjectIntoMethod(String name, String desc)RulelookupRule(String triggerMethodName, String triggerMethodDescriptor)called by a trigger adapter to find a rule specific to a given trigger method, expects to find a rule created by the corresponding check adapter.booleanmatchTargetMethod(int access, String name, String desc)voidparseRule()voidrecordFailedTransform(Throwable th)byte[]transform(byte[] targetClassBytes)voidwarn(String triggerMethodName, String triggerMethodDescriptor, String warningMessage)called by a check adapter to warn that a transform was not possible for a potential match target.
-
-
-
Field Detail
-
TOFU
public static final String TOFU
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TransformContext
public TransformContext(Transformer transformer, RuleScript ruleScript, String triggerClassName, ClassLoader loader, HelperManager helperManager, AccessEnabler accessEnabler)
-
-
Method Detail
-
transform
public byte[] transform(byte[] targetClassBytes)
-
lookupRule
public Rule lookupRule(String triggerMethodName, String triggerMethodDescriptor)
called by a trigger adapter to find a rule specific to a given trigger method, expects to find a rule created by the corresponding check adapter. if no rule is found then injection must be bypassed for this method- Parameters:
triggerMethodName- the name of a candidate method for injectiontriggerMethodDescriptor- the descriptor of a candidate method for injection- Returns:
- the rule if it exists or NULL if not
-
createRule
public Rule createRule(String triggerMethodName, String triggerMethodDescriptor)
called by a check adapter to create a rule specific to a given trigger method. the first such call reuses the rule created by the intiial parse. subsequent calls create a new rule.- Parameters:
triggerMethodName- the name of a candidate method for injectiontriggerMethodDescriptor- the descriptor of a candidate method for injection- Returns:
- the new rule
-
warn
public void warn(String triggerMethodName, String triggerMethodDescriptor, String warningMessage)
called by a check adapter to warn that a transform was not possible for a potential match target. this inhibits injection into the method being warned about allowing other injection operations to continue.- Parameters:
triggerMethodName- the name of a candidate method for injectiontriggerMethodDescriptor- the descriptor of a candidate method for injectionwarningMessage- details of the warning
-
fail
public void fail(String failMessage, String triggerMethodName, String triggerMethodDescriptor)
called by a check or trigger adapter to fail a transform because of a type issue. this aborts all injection into the current class not just injection into the current method.- Parameters:
failMessage- details of the failuretriggerMethodName- the name of a candidate method for injectiontriggerMethodDescriptor- the descriptor of a candidate method for injection
-
recordFailedTransform
public void recordFailedTransform(Throwable th)
-
getTriggerClassName
public String getTriggerClassName()
-
-