public class RuleScript extends Object
Constructor and Description |
---|
RuleScript(String name,
String targetClass,
boolean isInterface,
boolean isOverride,
String targetMethod,
String targetHelper,
String[] imports,
Location targetLocation,
String ruleText,
int line,
String file,
boolean compileToBytecode)
standard constructor for a rule
|
Modifier and Type | Method and Description |
---|---|
String |
getFile() |
String[] |
getImports() |
int |
getLine() |
String |
getName() |
String |
getRuleText() |
String |
getTargetClass() |
String |
getTargetHelper() |
Location |
getTargetLocation() |
String |
getTargetMethod() |
List<Transform> |
getTransformed()
getter for list of transforms applied for this script.
|
int |
getTransformedCount()
return a count of the number of transforms applied for this script.
|
boolean |
hasTransform(Class<?> clazz)
check whether a rule has been used to transform a specific class.
|
boolean |
isCompileToBytecode() |
boolean |
isDeleted()
called when indexing a script to ensure that it has not already been deleted.
|
boolean |
isInterface() |
boolean |
isOverride() |
void |
purge()
uninstall any rules associated with this script.
|
void |
recordCompile(String triggerClass,
ClassLoader loader,
boolean successful,
String detail)
record the fact that a rule has been compiled with or without success
|
boolean |
recordFailedTransform(ClassLoader loader,
String internalClassName,
Throwable th)
record the fact that an error was thrown when attempting to transform a given class using this rule script
|
boolean |
recordMethodTransform(ClassLoader loader,
String internalClassName,
String triggerMethodName,
String desc,
Rule rule)
record the fact that a trigger call has been successfully installed into bytecode associated with a specific
class and loader and a corresponding rule instance been installed
|
boolean |
recordTransform(ClassLoader loader,
String internalClassName,
String triggerMethodName,
String desc,
Rule rule,
Throwable th)
record the fact that a trigger call has failed to install into bytecode associated with a specific
class and loader
|
boolean |
setDeleted()
invoked by the scriptmanager when a rule is redefined to inhibit further transformations via this script
|
String |
toString() |
void |
writeTo(PrintWriter writer) |
public RuleScript(String name, String targetClass, boolean isInterface, boolean isOverride, String targetMethod, String targetHelper, String[] imports, Location targetLocation, String ruleText, int line, String file, boolean compileToBytecode)
name
- the name of the ruletargetClass
- the name of the class or interface to which the rule appliesisInterface
- true if the ruel applies to an interface false if it appies ot a classisOverride
- true if the rule should inject down class hierarchies false if it should inly inject into direct implementationstargetMethod
- the name of the method to which the rule appliestargetHelper
- the name of the helper class to be usedimports
- the list of imports for the module systemtargetLocation
- description of where the rule should be injectedruleText
- the body of the rule as text including the BIND, IF and DO clasueline
- the line at which the rule starts in it's rule scriptfile
- the path to the file containing the rulecompileToBytecode
- true if the rule should be compiled otherwise falsepublic String getName()
public String getTargetClass()
public boolean isInterface()
public String getTargetHelper()
public String[] getImports()
public String getTargetMethod()
public boolean isOverride()
public Location getTargetLocation()
public String getRuleText()
public int getLine()
public String getFile()
public boolean isCompileToBytecode()
public List<Transform> getTransformed()
public int getTransformedCount()
public boolean setDeleted()
public boolean isDeleted()
public boolean recordFailedTransform(ClassLoader loader, String internalClassName, Throwable th)
loader
- the loader of the class for which injection was attemptedinternalClassName
- the internal Java name of the classth
- the Throwable reocrding details of the failurepublic boolean recordMethodTransform(ClassLoader loader, String internalClassName, String triggerMethodName, String desc, Rule rule)
loader
- the loader of the class for which injection was attemptedinternalClassName
- the internal Java name of the classtriggerMethodName
- the name of the method injected intodesc
- the descriptor of the method injected intorule
- the rule which was injectedpublic boolean recordTransform(ClassLoader loader, String internalClassName, String triggerMethodName, String desc, Rule rule, Throwable th)
loader
- the loader of the class for which injection was attemptedinternalClassName
- the internal Java name of the classtriggerMethodName
- the name of the method injected intodesc
- the descriptor of the method injected intorule
- the rule which was injectedth
- throwable generated during the attempt to parse the rule text or inject code at the trigger pointpublic boolean hasTransform(Class<?> clazz)
clazz
- the class for which a transform is being sought.public void recordCompile(String triggerClass, ClassLoader loader, boolean successful, String detail)
triggerClass
- the name of the trigger class to which the rule is attachedloader
- the classloader of the trigger classsuccessful
- true if the rule compiled successfully and false if it suffered from parse,
type or compile errorsdetail
- text decribing more details of the compilation outcomepublic void purge()
public void writeTo(PrintWriter writer)
Copyright © 2018. All rights reserved.