|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.rule.impl.DefaultRuleSelector
This is a default implementation of the RuleSelector
interface.
This class has public
visibility due to an implementation
side effect. This class should have package
visibility.
Do not create instances of this class directly. Instead use the wt.rule.RuleSelectorFactory
class to obtain an instance.
Given a target object O
and a rule type R
,
this delegate picks a rule from the set of default enabled rules of type
R
based on the following precedence rules:
InstanceBasedRule
that references O
InstanceBasedRule
that references O
's master
TypeBasedRule
that references O
's class
null
is returned.
Field Summary | |
private static String |
CLASSNAME
|
private static String |
RESOURCE
|
private static String |
RULE_RESOURCE
|
Constructor Summary | |
DefaultRuleSelector()
|
Method Summary | |
private static InstanceBasedRule |
findIBR(RuleType ruleType,
Persistable object,
WTContainerRef container)
Find the default-enabled InstanceBasedRule
that satisfies the specified search criteria. |
private static TypeBasedRule |
findTBR(RuleType ruleType,
Class objType,
WTContainerRef container)
Find the default-enabled TypeBasedRule
that satisfies the specified search criteria. |
Rule |
getRule(Object object,
RuleType ruleType,
WTContainerRef container)
Select a rule of type ruleType that is applicable to
object . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final String RESOURCE
private static final String CLASSNAME
private static final String RULE_RESOURCE
Constructor Detail |
public DefaultRuleSelector()
Method Detail |
public Rule getRule(Object object, RuleType ruleType, WTContainerRef container) throws WTException
ruleType
that is applicable to
object
. If no rule can be found, return null
.
The object
argument may be a type identifier or
a normal object. A type identifier is one of the following:
Class
TypeIdentifier
String
specifying the name of the type
Different implementations of this interface will use the criteria in different ways to select a rule.
getRule
in interface RuleSelector
object
- the object that the rule should be applicable to (cannot be null
)ruleType
- the type of rule to select (cannot be null
)container
- the container in which to search for the rule
WTException
private static final InstanceBasedRule findIBR(RuleType ruleType, Persistable object, WTContainerRef container) throws WTException
InstanceBasedRule
that satisfies the specified search criteria. Start the search
for the rule in the specified container.
Continue the search up the hierarchy until a rule is found or
the top of the hierarchy is reached.
ruleType
- object
- container
- the container to start searching in
WTException
private static final TypeBasedRule findTBR(RuleType ruleType, Class objType, WTContainerRef container) throws WTException
TypeBasedRule
that satisfies the specified search criteria. Start the search
for the rule in the specified container.
Continue the search up the hierarchy until a rule is found or
the top of the hierarchy is reached.
ruleType
- objType
- container
- the container to start searching in
WTException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |