|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.betwixt.strategy.ClassNormalizer org.apache.commons.betwixt.strategy.ListedClassNormalizer
public class ListedClassNormalizer
ClassNormalizer that uses a list of substitutions.
This ClassNormalizer
checks a list (in order) to find a matching
Class.
This match can be performed either strictly (using equality) or taking into account
inheritance and implementation.
If a match is found then the first substituted class is returned as the normalization.
Constructor Summary | |
---|---|
ListedClassNormalizer()
|
Method Summary | |
---|---|
void |
addSubstitution(java.lang.Class substitute)
Adds the given substitute to the list. |
void |
addSubstitution(java.lang.Class match,
java.lang.Class substitute)
Adds this given substitution to the list. |
boolean |
isStrickCheck()
Is strict checking of substitutions on? |
java.lang.Class |
normalize(java.lang.Class clazz)
Normalize given class. |
void |
setStrickCheck(boolean strickCheck)
Sets strict checking of substitutions? |
Methods inherited from class org.apache.commons.betwixt.strategy.ClassNormalizer |
---|
getNormalizedClass |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ListedClassNormalizer()
Method Detail |
---|
public boolean isStrickCheck()
public void setStrickCheck(boolean strickCheck)
strickCheck
- if true then equality will be used to compare classes
when considering substition,
otherwise isAssignableFrom will be used so that super classes and super interfaces
will be matched.public void addSubstitution(java.lang.Class match, java.lang.Class substitute)
match
- if any classes matching this then the normal class will be substitutedsubstitute
- the normalized Class if the primary class is matchedpublic void addSubstitution(java.lang.Class substitute)
isStrickCheck()
is false.
In this case, any subclasses (if this is a class) or implementating classes
if this is an interface) will be subsituted with this value.
substitute
- sustitude this Classpublic java.lang.Class normalize(java.lang.Class clazz)
normalize
in class ClassNormalizer
clazz
- the class to normalize, not null
isStrickCheck()
then equality
is used otherwise isAssignableFrom is used (so that super class and interfaces are matched).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |