|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.pfsw.text.MatchElement
org.pfsw.text.MatchAttribute
public class MatchAttribute
An instance of this class holds the name and the pattern values for one attribute. With the matches() method it can be checked against a Map of attributes.
| Constructor Summary | |
|---|---|
MatchAttribute()
Initialize the new instance with default values. |
|
MatchAttribute(java.lang.String name)
Initialize the new instance with a name. |
|
| Method Summary | ||
|---|---|---|
protected void |
apply(MatchRuleVisitor visitor)
|
|
protected void |
applyDatatypes(java.util.Map<java.lang.String,java.lang.Class<?>> datatypes)
|
|
protected boolean |
compare(java.lang.Integer value,
java.lang.String ruleValue)
Returns true if the given value compared by using the current operator to the rule value evaluates to true. |
|
protected boolean |
compare(java.lang.String value,
java.lang.String ruleValue,
boolean ignoreCase)
Returns true if the given value compared by using the current operator to the rule value evaluates to true. |
|
protected boolean |
compareIntegers(int a,
int b)
|
|
protected void |
convertToBigDecimal(java.lang.String[] strValues)
|
|
protected void |
convertToDate(java.lang.String[] strValues,
java.text.SimpleDateFormat dateFormat)
|
|
protected void |
convertToDouble(java.lang.String[] strValues)
|
|
protected void |
convertToFloat(java.lang.String[] strValues)
|
|
protected void |
convertToInteger(java.lang.String[] strValues)
|
|
protected void |
convertToLong(java.lang.String[] strValues)
|
|
protected void |
convertToType(java.lang.Object type)
|
|
protected MatchRuleException |
createTypeConversionException(java.lang.String value,
java.lang.Class<?> type)
|
|
protected boolean |
doBigDecimalMatch(java.lang.Object value)
|
|
protected boolean |
doDateMatch(java.lang.Object value)
|
|
protected boolean |
doDoubleMatch(java.lang.Object value)
|
|
protected boolean |
doFloatMatch(java.lang.Object value)
|
|
protected boolean |
doIntegerMatch(java.lang.Object value)
|
|
protected boolean |
doLongMatch(java.lang.Object value)
|
|
protected boolean |
doMatch(java.util.Map<java.lang.String,?> dictionary)
|
|
protected boolean |
doTypedMatch(java.lang.Object object)
|
|
java.lang.String |
getAttributeName()
Returns the name of the attribute that will be checked by this rule element |
|
StringPattern[] |
getPatterns()
Returns the value pattern(s) against that will be matched |
|
protected java.lang.Class<?> |
getTypeOf(java.lang.Object object)
Returns the type of the given object or if it is an array or a list the type of its first element. |
|
protected java.lang.Object |
getValueType()
|
|
protected void |
ignoreCase(boolean ignoreIt)
|
|
boolean |
ignoreCaseInName()
Returns true, if the attribute name should be treated not case-sensitive. |
|
protected void |
ignoreCaseInName(boolean newValue)
Sets whether the attribute name should be treated not case-sensitive. |
|
boolean |
isAttribute()
Returns true, if the element is an attribute element. |
|
protected boolean |
isCorrectType(java.lang.Object value)
|
|
protected boolean |
isTyped()
|
|
protected boolean |
matchValue(java.lang.Object value)
|
|
protected
|
matchValueAgainstValues(java.lang.Comparable<T> value,
T[] values)
|
|
protected boolean |
matchValueArray(java.lang.Object[] values)
|
|
protected boolean |
matchValueCollection(java.util.Collection<?> values)
|
|
protected void |
multiCharWildcardMatchesEmptyString(boolean yesOrNo)
|
|
protected java.lang.String |
nameOfAttribute(java.util.Map<java.lang.String,?> map)
|
|
protected java.lang.String |
objectAsString(java.lang.Object object)
Returns the string representation of the given object. |
|
protected MatchRuleCompareOperator |
operator()
|
|
protected void |
operator(MatchRuleCompareOperator newValue)
|
|
void |
setAttributeName(java.lang.String newValue)
Sets the name of the attribute that will be checked by this rule element |
|
void |
setDatatype(java.lang.Object type)
Sets the datatype this attribute's value must have. |
|
void |
setEqualsOperator()
Sets the operator for value comparisons of this attribute to EQUALS. |
|
void |
setGreaterOperator()
Sets the operator for value comparisons of this attribute to GREATER. |
|
void |
setGreaterOrEqualOperator()
Sets the operator for value comparisons of this attribute to GREATER OR EQUAL. |
|
void |
setLessOperator()
Sets the operator for value comparisons of this attribute to LESS. |
|
void |
setLessOrEqualOperator()
Sets the operator for value comparisons of this attribute to LESS OR EQUAL. |
|
void |
setPattern(StringPattern aPattern)
Sets the specified pattern as the sole pattern to be checked when matching this attribute against a map. |
|
void |
setPatterns(StringPattern[] newValue)
Sets the value pattern(s) against that will be matched |
|
protected void |
setValueType(java.lang.Object newValue)
|
|
protected
|
toArray(java.lang.Object object,
java.lang.Class<T> type)
|
|
java.lang.String |
toString()
Returns a string containing the attribute name, the operator and the value(s) set in this part of a match rule. |
|
protected java.lang.Object |
valueInMap(java.util.Map<java.lang.String,?> map)
|
|
| Methods inherited from class org.pfsw.text.MatchElement |
|---|
getAnd, getNot, isGroup, matches, setAnd, setNot |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public MatchAttribute()
public MatchAttribute(java.lang.String name)
name - The name of the attribute| Method Detail |
|---|
public java.lang.String getAttributeName()
public void setAttributeName(java.lang.String newValue)
public StringPattern[] getPatterns()
public void setPatterns(StringPattern[] newValue)
public boolean ignoreCaseInName()
public boolean isAttribute()
isAttribute in class MatchElementpublic void setPattern(StringPattern aPattern)
public java.lang.String toString()
toString in class java.lang.Objectpublic void setEqualsOperator()
public void setGreaterOperator()
public void setLessOperator()
public void setGreaterOrEqualOperator()
public void setLessOrEqualOperator()
public void setDatatype(java.lang.Object type)
throws MatchRuleException
Currently supported datatypes are:
type - The type of the attribute's value
MatchRuleException - if the current value (pattern) cannot be converted to the specified datatypeprotected boolean doMatch(java.util.Map<java.lang.String,?> dictionary)
doMatch in class MatchElementprotected boolean doTypedMatch(java.lang.Object object)
protected boolean isCorrectType(java.lang.Object value)
protected boolean doFloatMatch(java.lang.Object value)
protected boolean doDoubleMatch(java.lang.Object value)
protected boolean doBigDecimalMatch(java.lang.Object value)
protected boolean doIntegerMatch(java.lang.Object value)
protected boolean doLongMatch(java.lang.Object value)
protected boolean doDateMatch(java.lang.Object value)
protected boolean matchValueArray(java.lang.Object[] values)
protected boolean matchValueCollection(java.util.Collection<?> values)
protected boolean matchValue(java.lang.Object value)
protected <T> boolean matchValueAgainstValues(java.lang.Comparable<T> value,
T[] values)
protected boolean compare(java.lang.String value,
java.lang.String ruleValue,
boolean ignoreCase)
protected boolean compare(java.lang.Integer value,
java.lang.String ruleValue)
protected boolean compareIntegers(int a,
int b)
protected void ignoreCase(boolean ignoreIt)
ignoreCase in class MatchElementprotected void multiCharWildcardMatchesEmptyString(boolean yesOrNo)
multiCharWildcardMatchesEmptyString in class MatchElementprotected void apply(MatchRuleVisitor visitor)
apply in class MatchElementprotected java.lang.Object valueInMap(java.util.Map<java.lang.String,?> map)
protected java.lang.String nameOfAttribute(java.util.Map<java.lang.String,?> map)
protected void convertToType(java.lang.Object type)
throws MatchRuleException
MatchRuleException
protected void convertToFloat(java.lang.String[] strValues)
throws MatchRuleException
MatchRuleException
protected void convertToDouble(java.lang.String[] strValues)
throws MatchRuleException
MatchRuleException
protected void convertToBigDecimal(java.lang.String[] strValues)
throws MatchRuleException
MatchRuleException
protected void convertToInteger(java.lang.String[] strValues)
throws MatchRuleException
MatchRuleException
protected void convertToLong(java.lang.String[] strValues)
throws MatchRuleException
MatchRuleException
protected void convertToDate(java.lang.String[] strValues,
java.text.SimpleDateFormat dateFormat)
throws MatchRuleException
MatchRuleException
protected MatchRuleException createTypeConversionException(java.lang.String value,
java.lang.Class<?> type)
protected boolean isTyped()
protected java.lang.Class<?> getTypeOf(java.lang.Object object)
protected <T> T[] toArray(java.lang.Object object,
java.lang.Class<T> type)
protected void applyDatatypes(java.util.Map<java.lang.String,java.lang.Class<?>> datatypes)
throws MatchRuleException
applyDatatypes in class MatchElementMatchRuleExceptionprotected java.lang.String objectAsString(java.lang.Object object)
object - The object to get the string representation of (may be null).
protected void ignoreCaseInName(boolean newValue)
ignoreCaseInName in class MatchElementprotected java.lang.Object getValueType()
protected void setValueType(java.lang.Object newValue)
protected MatchRuleCompareOperator operator()
protected void operator(MatchRuleCompareOperator newValue)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||