/** * 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 * @param triggerMethodName the name of a candidate method for injection * @param triggerMethodDescriptor the descriptor of a candidate method for injection * @return the rule if it exists or NULL if not */ public Rule lookupRule(String triggerMethodName, String triggerMethodDescriptor) { String key = getRuleKey(triggerMethodName, triggerMethodDescriptor); return ruleMap.get(key); }
/** * 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 * @param triggerMethodName the name of a candidate method for injection * @param triggerMethodDescriptor the descriptor of a candidate method for injection * @return the rule if it exists or NULL if not */ public Rule lookupRule(String triggerMethodName, String triggerMethodDescriptor) { String key = getRuleKey(triggerMethodName, triggerMethodDescriptor); return ruleMap.get(key); }
/** * 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. * @param triggerMethodName the name of a candidate method for injection * @param triggerMethodDescriptor the descriptor of a candidate method for injection * @return the new rule */ public Rule createRule(String triggerMethodName, String triggerMethodDescriptor) { String key = getRuleKey(triggerMethodName, triggerMethodDescriptor); // use the initially parsed rule if we can otherwise create one Rule rule = ruleMap.remove(triggerClassName); if (rule == null) { try { rule = Rule.create(ruleScript, loader, helperManager, accessEnabler); } catch(Throwable th) { // will not happen } } ruleMap.put(key, rule); return rule; }
/** * 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. * @param triggerMethodName the name of a candidate method for injection * @param triggerMethodDescriptor the descriptor of a candidate method for injection * @return the new rule */ public Rule createRule(String triggerMethodName, String triggerMethodDescriptor) { String key = getRuleKey(triggerMethodName, triggerMethodDescriptor); // use the initially parsed rule if we can otherwise create one Rule rule = ruleMap.remove(triggerClassName); if (rule == null) { try { rule = Rule.create(ruleScript, loader, helperManager, accessEnabler); } catch(Throwable th) { // will not happen } } ruleMap.put(key, rule); return rule; }
/** * 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. * @param triggerMethodName the name of a candidate method for injection * @param triggerMethodDescriptor the descriptor of a candidate method for injection * @param warningMessage details of the warning */ public void warn(String triggerMethodName, String triggerMethodDescriptor, String warningMessage) { // remove the rule so that we don't try to inject into this method String key = getRuleKey(triggerMethodName, triggerMethodDescriptor); Rule rule = ruleMap.remove(key); // now attach an exception to the rule script String message = warningMessage + " for method " + triggerMethodName + TypeHelper.internalizeDescriptor(triggerMethodDescriptor); TypeWarningException tw = new TypeWarningException(message); ruleScript.recordTransform(loader, triggerClassName, triggerMethodName, triggerMethodDescriptor, rule, tw); }
/** * 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. * @param triggerMethodName the name of a candidate method for injection * @param triggerMethodDescriptor the descriptor of a candidate method for injection * @param warningMessage details of the warning */ public void warn(String triggerMethodName, String triggerMethodDescriptor, String warningMessage) { // remove the rule so that we don't try to inject into this method String key = getRuleKey(triggerMethodName, triggerMethodDescriptor); Rule rule = ruleMap.remove(key); // now attach an exception to the rule script String message = warningMessage + " for method " + triggerMethodName + TypeHelper.internalizeDescriptor(triggerMethodDescriptor); TypeWarningException tw = new TypeWarningException(message); ruleScript.recordTransform(loader, triggerClassName, triggerMethodName, triggerMethodDescriptor, rule, tw); }
/** * 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. * @param failMessage details of the failure * @param triggerMethodName the name of a candidate method for injection * @param triggerMethodDescriptor the descriptor of a candidate method for injection */ public void fail(String failMessage, String triggerMethodName, String triggerMethodDescriptor) { String key = getRuleKey(triggerMethodName, triggerMethodDescriptor); Rule rule = ruleMap.get(key); String message = failMessage + " for method " + triggerMethodName + TypeHelper.internalizeDescriptor(triggerMethodDescriptor); TypeException te = new TypeException(message); ruleScript.recordTransform(loader, triggerClassName, triggerMethodName, triggerMethodDescriptor, rule, te); failed = true; throw new TransformFailure(); }
/** * 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. * @param failMessage details of the failure * @param triggerMethodName the name of a candidate method for injection * @param triggerMethodDescriptor the descriptor of a candidate method for injection */ public void fail(String failMessage, String triggerMethodName, String triggerMethodDescriptor) { String key = getRuleKey(triggerMethodName, triggerMethodDescriptor); Rule rule = ruleMap.get(key); String message = failMessage + " for method " + triggerMethodName + TypeHelper.internalizeDescriptor(triggerMethodDescriptor); TypeException te = new TypeException(message); ruleScript.recordTransform(loader, triggerClassName, triggerMethodName, triggerMethodDescriptor, rule, te); failed = true; throw new TransformFailure(); }