Class 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
    • 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 injection
        triggerMethodDescriptor - 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 injection
        triggerMethodDescriptor - 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 injection
        triggerMethodDescriptor - the descriptor of a candidate method for injection
        warningMessage - 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 failure
        triggerMethodName - the name of a candidate method for injection
        triggerMethodDescriptor - the descriptor of a candidate method for injection
      • recordFailedTransform

        public void recordFailedTransform​(Throwable th)
      • matchTargetMethod

        public boolean matchTargetMethod​(int access,
                                         String name,
                                         String desc)
      • injectIntoMethod

        public boolean injectIntoMethod​(String name,
                                        String desc)
      • getTriggerClassName

        public String getTriggerClassName()