public class Rule extends Object
Modifier and Type | Method and Description |
---|---|
int |
addAccessibleField(Field field) |
int |
addAccessibleMethod(Method method) |
void |
compile()
install helper class used to execute this rule.
|
static Rule |
create(RuleScript ruleScript,
ClassLoader loader,
HelperManager helperManager) |
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 |
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
|
String |
getName() |
long |
getObjectSize(Object o) |
Type |
getReturnType() |
String |
getTargetClass() |
Location |
getTargetLocation() |
String |
getTargetMethod() |
String |
getTriggerClass() |
String |
getTriggerDescriptor() |
String |
getTriggerMethod() |
TypeGroup |
getTypeGroup() |
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
|
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
|
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 static Rule create(RuleScript ruleScript, ClassLoader loader, HelperManager helperManager) 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 ruele contains type errorspublic 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 int addAccessibleField(Field field)
public int addAccessibleMethod(Method method)
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 long getObjectSize(Object o)
Copyright © 2015. All rights reserved.