public final class Rule extends java.lang.Object implements RuleConstants, java.io.Serializable, com.ibm.websphere.cache.Sizeable
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
XML_DTD_FRAGMENT, XML_INDENT
Constructor and Description |
---|
Rule(Condition condition,
Action action)
This constructor takes a
Condition object and an Action object. |
Modifier and Type | Method and Description |
---|---|
Action |
getAction()
Gets the action for this rule.
|
java.lang.String |
getComment()
Gets the comment for this rule.
|
Condition |
getCondition()
Gets the condition for this rule.
|
long |
getObjectSize()
Returns the estimated footprint size in bytes
of this object and the objects it contains.
|
java.lang.String |
getXMLDocument()
Gets an XML document that describes this rule.
|
java.lang.String |
getXMLFragment(java.lang.String indent)
Gets an XML fragment that describes the rule.
|
void |
invoke(Evaluator evaluator,
ActionHandler handler)
Invoke the rule.
|
static Rule |
loadRuleFromXML(org.w3c.dom.Element element)
Loads a
Rule object from an XML element object. |
static Rule |
loadRuleFromXML(java.lang.String xml)
Loads a
Rule object from an XML document. |
void |
setAction(Action action)
Sets the action for this rule.
|
void |
setComment(java.lang.String comment)
Sets the comment for this rule.
|
void |
setCondition(Condition condition)
Sets the condition for this rule.
|
public static final java.lang.String COPYRIGHT
public long getObjectSize()
getObjectSize
in interface com.ibm.websphere.cache.Sizeable
public Condition getCondition()
Condition
object.public void setCondition(Condition condition)
condition
- A Condition
object.public Action getAction()
Action
object.public void setAction(Action action)
action
- An Action
object.public java.lang.String getComment()
public void setComment(java.lang.String comment)
comment
- A comment string.public void invoke(Evaluator evaluator, ActionHandler handler)
evaluator
- The Evaluator
that is used to evaluate the condition.handler
- The ActionHandler
that is used to perform the action.public java.lang.String getXMLDocument()
<!DOCTYPE rule [
<!ELEMENT rule (comment?, (orListCondition | andListCondition | simpleCondition | trueCondition | openCondition), action)>
<!ELEMENT comment EMPTY>
<!ATTLIST comment text CDATA #REQUIRED>
<!ELEMENT action (parameter*)>
<!ATTLIST action name CDATA #REQUIRED>
<!ELEMENT orListCondition (not?, (orListCondition | andListCondition | simpleCondition | trueCondition | openCondition)+)>
<!ELEMENT andListCondition (not?, (orListCondition | andListCondition | simpleCondition | trueCondition | openCondition)+)>
<!ELEMENT simpleCondition (not?, variable, operator, value, qualifier*)>
<!ELEMENT openCondition (not?, parameter*)>
<!ATTLIST openCondition name CDATA #REQUIRED>
<!ELEMENT trueCondition (not?)>
<!ELEMENT not EMPTY>
<!ELEMENT variable EMPTY>
<!ATTLIST variable name CDATA #REQUIRED>
<!ELEMENT operator EMPTY>
<!ATTLIST operator name CDATA #REQUIRED>
<!ELEMENT value EMPTY>
<!ATTLIST value data CDATA #REQUIRED>
<!ELEMENT qualifier EMPTY>
<!ATTLIST qualifier name CDATA #REQUIRED>
<!ATTLIST qualifier data CDATA #REQUIRED>
<!ELEMENT parameter (parameter*)>
<!ATTLIST parameter name CDATA #REQUIRED>
<!ATTLIST parameter value CDATA #REQUIRED>
]>
public java.lang.String getXMLFragment(java.lang.String indent)
<!ELEMENT rule (comment?, (orListCondition | andListCondition | simpleCondition | trueCondition | openCondition), action)>
<!ELEMENT comment EMPTY>
<!ATTLIST comment text CDATA #REQUIRED>
<!ELEMENT action (parameter*)>
<!ATTLIST action name CDATA #REQUIRED>
<!ELEMENT orListCondition (not?, (orListCondition | andListCondition | simpleCondition | trueCondition | openCondition)+)>
<!ELEMENT andListCondition (not?, (orListCondition | andListCondition | simpleCondition | trueCondition | openCondition)+)>
<!ELEMENT simpleCondition (not?, variable, operator, value, qualifier*)>
<!ELEMENT openCondition (not?, parameter*)>
<!ATTLIST openCondition name CDATA #REQUIRED>
<!ELEMENT trueCondition (not?)>
<!ELEMENT not EMPTY>
<!ELEMENT variable EMPTY>
<!ATTLIST variable name CDATA #REQUIRED>
<!ELEMENT operator EMPTY>
<!ATTLIST operator name CDATA #REQUIRED>
<!ELEMENT value EMPTY>
<!ATTLIST value data CDATA #REQUIRED>
<!ELEMENT qualifier EMPTY>
<!ATTLIST qualifier name CDATA #REQUIRED>
<!ATTLIST qualifier data CDATA #REQUIRED>
<!ELEMENT parameter (parameter*)>
<!ATTLIST parameter name CDATA #REQUIRED>
<!ATTLIST parameter value CDATA #REQUIRED>
public static Rule loadRuleFromXML(java.lang.String xml)
Rule
object from an XML document.xml
- An XML document.Rule
object that matches the XML.public static Rule loadRuleFromXML(org.w3c.dom.Element element)
Rule
object from an XML element object.element
- An XML Element object.Rule
object that matches the XML.