public class Rule extends Object
Modifier and Type | Method | Description |
---|---|---|
int |
addAccessibleConstructorInvoker(Constructor constructor) |
|
int |
addAccessibleFieldGetter(Field field) |
|
int |
addAccessibleFieldSetter(Field field) |
|
int |
addAccessibleMethodInvoker(Method method) |
|
void |
compile() |
install helper class used to execute this rule.
|
static Rule |
create(RuleScript ruleScript,
ClassLoader loader,
HelperManager helperManager,
AccessEnabler accessEnabler) |
|
static boolean |
disableTriggers() |
disable triggering of rules inside the current thread.
|
static boolean |
disableTriggersInternal() |
disable triggering of rules inside the current thread.
|
static boolean |
enableTriggers() |
enable triggering of rules inside the current thread.
|
static boolean |
enableTriggersInternal() |
enable triggering of rules inside the current thread n.b.
|
static void |
execute(String key,
Object recipient,
Object[] args) |
forward an execute request a rule identified by its unique key
|
Object |
getAccessibleField(Object owner,
int fieldIndex) |
|
Action |
getAction() |
|
Bindings |
getBindings() |
|
Condition |
getCondition() |
|
Event |
getEvent() |
|
String |
getFile() |
retrieve the name of the file containing this rule
|
Class |
getHelperClass() |
a getter allowing the helper class for the rule to be identified
|
String |
getHelperImplementationClassName() |
a getter allowing the helper implementation class name for the rule to be identified
|
ClassLoader |
getHelperLoader() |
get the class loader of the rule-specific helper adapter class
|
String |
getKey() |
called when a trigger is compiled for the rule to provide a String key which can be used
at execution time to obtain a handle on the rule instance
|
int |
getLine() |
retrieve the start line for the rule
|
ClassLoader |
getLoader() |
get the class loader of the target class for the rule
|
ModuleSystem |
getModuleSystem() |
|
String |
getName() |
|
long |
getObjectSize(Object o) |
|
Type |
getReturnType() |
|
String |
getTargetClass() |
|
Location |
getTargetLocation() |
|
String |
getTargetMethod() |
|
String |
getTriggerClass() |
|
String |
getTriggerDescriptor() |
|
String |
getTriggerMethod() |
|
TypeGroup |
getTypeGroup() |
|
void |
installed() |
method called when the rule has been successfully injected into a class, type checked and compiled.
|
void |
invokeAccessibleConstructor(Object[] args,
int methodIndex) |
|
Object |
invokeAccessibleMethod(Object target,
Object[] args,
int methodIndex) |
|
boolean |
isChecked() |
has this rule been typechecked and/or compiled
|
boolean |
isCheckedOk() |
has this rule been typechecked and compiled without error.
|
boolean |
isCheckFailed() |
has this rule failed to typecheck or compile
|
boolean |
isInterface() |
|
boolean |
isOverride() |
|
static boolean |
isTriggeringEnabled() |
check if triggering of rules is enabled inside the current thread
|
String |
lookupKey() |
return the key under which this rule has been indexed in the rule key map
|
void |
purge() |
delete any reference to the rule from the rule map
|
boolean |
requiresAccess(Field field) |
|
boolean |
requiresAccess(Method method) |
|
boolean |
requiresAccess(Type type) |
|
void |
setAccessibleField(Object owner,
Object value,
int fieldIndex) |
|
void |
setAction(String actionSpec) |
|
void |
setCondition(String conditionSpec) |
|
void |
setEvent(String eventSpec) |
|
void |
setTypeInfo(String className,
int access,
String methodName,
String desc,
String[] exceptions) |
|
String |
toString() |
generate a string representation of the rule
|
void |
typeCheck() |
type check this rule
|
void |
uninstalled() |
method called when the rule has been uninstalled after previously being successfully injected into a class,
type checked and compiled.
|
public TypeGroup getTypeGroup()
public Bindings getBindings()
public String getName()
public String getTargetClass()
public String getTargetMethod()
public Location getTargetLocation()
public boolean isOverride()
public boolean isInterface()
public int getLine()
public String getFile()
public Event getEvent()
public Condition getCondition()
public Action getAction()
public String getTriggerClass()
public String getTriggerMethod()
public String getTriggerDescriptor()
public Type getReturnType()
public ClassLoader getLoader()
public ClassLoader getHelperLoader()
public static Rule create(RuleScript ruleScript, ClassLoader loader, HelperManager helperManager, AccessEnabler accessEnabler) throws ParseException, TypeException, CompileException
public void setEvent(String eventSpec) throws ParseException, TypeException
ParseException
TypeException
public void setCondition(String conditionSpec) throws ParseException, TypeException
ParseException
TypeException
public void setAction(String actionSpec) throws ParseException, TypeException
ParseException
TypeException
public void setTypeInfo(String className, int access, String methodName, String desc, String[] exceptions)
public boolean isChecked()
public boolean isCheckFailed()
public boolean isCheckedOk()
public static boolean disableTriggersInternal()
public static boolean enableTriggersInternal()
public static boolean disableTriggers()
public static boolean enableTriggers()
public static boolean isTriggeringEnabled()
public void typeCheck() throws TypeException
TypeException
- if the rule contains type errorspublic ModuleSystem getModuleSystem()
public void compile() throws CompileException
CompileException
- if the rule cannot be compiledpublic static void execute(String key, Object recipient, Object[] args) throws ExecuteException
key
- a string key identifying the rule instance to be firedrecipient
- the recipient of the method from which execution of the rule was
triggered or null if it was a static methodargs
- the arguments of the method from which execution of the rule was
triggeredExecuteException
public String getKey()
public String lookupKey()
public void purge()
public String toString()
public Class getHelperClass()
public String getHelperImplementationClassName()
public void installed()
public void uninstalled()
public boolean requiresAccess(Type type)
public boolean requiresAccess(Field field)
public boolean requiresAccess(Method method)
public int addAccessibleFieldGetter(Field field)
public int addAccessibleFieldSetter(Field field)
public int addAccessibleMethodInvoker(Method method)
public int addAccessibleConstructorInvoker(Constructor constructor)
public Object getAccessibleField(Object owner, int fieldIndex) throws ExecuteException
ExecuteException
public void setAccessibleField(Object owner, Object value, int fieldIndex) throws ExecuteException
ExecuteException
public Object invokeAccessibleMethod(Object target, Object[] args, int methodIndex)
public void invokeAccessibleConstructor(Object[] args, int methodIndex)
public long getObjectSize(Object o)
Copyright © 2018. All rights reserved.