org.pf.text
Class MatchAttribute

java.lang.Object
  extended by org.pf.text.MatchElement
      extended by org.pf.text.MatchAttribute
All Implemented Interfaces:
java.io.Serializable

public class MatchAttribute
extends MatchElement
implements java.io.Serializable

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.

Version:
2.0
Author:
Manfred Duchrow
See Also:
Serialized Form

Field Summary
static int OPERATOR_EQUALS
          The operator value for EQUALS
static int OPERATOR_GREATER
          The operator value for GREATER
static int OPERATOR_GREATER_OR_EQUAL
          The operator value for GREATER OR EQUAL
static int OPERATOR_LESS
          The operator value for LESS
static int OPERATOR_LESS_OR_EQUAL
          The operator value for LESS OR EQUAL
 
Constructor Summary
MatchAttribute()
          Initialize the new instance with default values.
MatchAttribute(java.lang.String name)
          Initialize the new instance with a name.
 
Method Summary
 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
 boolean ignoreCaseInName()
          Returns true, if the attribute name should be treated not case-sensitive.
 boolean isAttribute()
          Returns true, if the element is an attribute element.
 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
 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.
 
Methods inherited from class org.pf.text.MatchElement
getAnd, getNot, isGroup, matches, setAnd, setNot
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OPERATOR_EQUALS

public static final int OPERATOR_EQUALS
The operator value for EQUALS

See Also:
Constant Field Values

OPERATOR_GREATER

public static final int OPERATOR_GREATER
The operator value for GREATER

See Also:
Constant Field Values

OPERATOR_LESS

public static final int OPERATOR_LESS
The operator value for LESS

See Also:
Constant Field Values

OPERATOR_GREATER_OR_EQUAL

public static final int OPERATOR_GREATER_OR_EQUAL
The operator value for GREATER OR EQUAL

See Also:
Constant Field Values

OPERATOR_LESS_OR_EQUAL

public static final int OPERATOR_LESS_OR_EQUAL
The operator value for LESS OR EQUAL

See Also:
Constant Field Values
Constructor Detail

MatchAttribute

public MatchAttribute()
Initialize the new instance with default values.


MatchAttribute

public MatchAttribute(java.lang.String name)
Initialize the new instance with a name.

Parameters:
name - The name of the attribute
Method Detail

getAttributeName

public java.lang.String getAttributeName()
Returns the name of the attribute that will be checked by this rule element


setAttributeName

public void setAttributeName(java.lang.String newValue)
Sets the name of the attribute that will be checked by this rule element


getPatterns

public StringPattern[] getPatterns()
Returns the value pattern(s) against that will be matched


setPatterns

public void setPatterns(StringPattern[] newValue)
Sets the value pattern(s) against that will be matched


ignoreCaseInName

public boolean ignoreCaseInName()
Returns true, if the attribute name should be treated not case-sensitive.


isAttribute

public boolean isAttribute()
Returns true, if the element is an attribute element.
Here this method always returns true.

Overrides:
isAttribute in class MatchElement

setPattern

public void setPattern(StringPattern aPattern)
Sets the specified pattern as the sole pattern to be checked when matching this attribute against a map.


toString

public 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.

Overrides:
toString in class java.lang.Object

setEqualsOperator

public void setEqualsOperator()
Sets the operator for value comparisons of this attribute to EQUALS.


setGreaterOperator

public void setGreaterOperator()
Sets the operator for value comparisons of this attribute to GREATER.


setLessOperator

public void setLessOperator()
Sets the operator for value comparisons of this attribute to LESS.


setGreaterOrEqualOperator

public void setGreaterOrEqualOperator()
Sets the operator for value comparisons of this attribute to GREATER OR EQUAL.


setLessOrEqualOperator

public void setLessOrEqualOperator()
Sets the operator for value comparisons of this attribute to LESS OR EQUAL.


setDatatype

public void setDatatype(java.lang.Object type)
                 throws MatchRuleException
Sets the datatype this attribute's value must have. Implicitly the current value (pattern) gets converted to that datatype.

Currently supported datatypes are:

Parameters:
type - The type of the attribute's value
Throws:
MatchRuleException - if the current value (pattern) cannot be converted to the specified datatype