FileDocCategorySizeDatePackage
AttributePredicate.javaAPI DocGlassfish v2 API3250Sat May 05 19:17:16 BST 2007org.apache.taglibs.standard.extra.spath

AttributePredicate

public class AttributePredicate extends Predicate

Represents a predicate expression concerning a single attribute.

author
Shawn Bayern

Fields Summary
private String
attribute
private String
target
Constructors Summary
public AttributePredicate(String attribute, String target)
Constructs a new AttributePredicate, given an attribute name and a target literal (with which to test equality).

	if (attribute == null)
	    throw new IllegalArgumentException("non-null attribute needed");
	if (attribute.indexOf(":") != -1)
	    throw new IllegalArgumentException(
		"namespace-qualified attribute names are not currently " +
		"supported");
	this.attribute = attribute;

	if (target == null)
	    throw new IllegalArgumentException("non-null target needed");
	// strip quotation marks from target
	this.target = target.substring(1, target.length() - 1);
    
Methods Summary
public booleanisMatchingAttribute(org.xml.sax.Attributes a)
Returns true if the given SAX AttributeList is suitable, given our attribute name and target; returns false otherwise.

	String attValue = a.getValue("", attribute);
	return (attValue != null && attValue.equals(target));