org.jaxen.expr

Class DefaultNameStep

public class DefaultNameStep extends DefaultStep implements NameStep

Deprecated: this class will become non-public in the future; use the interface instead

Expression object that represents any flavor of name-test steps within an XPath.

This includes simple steps, such as "foo", non-default-axis steps, such as "following-sibling::foo" or "@foo", and namespace-aware steps, such as "foo:bar".

Author: bob mcwhirter (bob@werken.com) Stephen Colebourne

Field Summary
booleanhasPrefix
Quick flag denoting if we have a namespace prefix *
StringlocalName
Our local-name.
booleanmatchesAnyName
Quick flag denoting if the local name was '*'
Stringprefix
Our prefix, bound through the current Context.
static longserialVersionUID
Constructor Summary
DefaultNameStep(IterableAxis axis, String prefix, String localName, PredicateSet predicateSet)
Constructor.
Method Summary
Listevaluate(Context context)
Evaluate the context node set to find the new node set.
StringgetLocalName()
Gets the local name.
StringgetPrefix()
Gets the namespace prefix.
StringgetText()
Gets the step as a fully defined XPath.
booleanhasNamespace(String uri)
Checks whether the URI represents a namespace.
booleanisMatchesAnyName()
Does this step match any name?
booleanmatches(Object node, ContextSupport contextSupport)
Checks whether the node matches this step.
protected booleanmatchesNamespaceURIs(String uri1, String uri2)
Compares two namespace URIs, handling null.
StringtoString()
Returns a full information debugging string.

Field Detail

hasPrefix

private boolean hasPrefix
Quick flag denoting if we have a namespace prefix *

localName

private String localName
Our local-name. This is the 'bar' in 'foo:bar'.

matchesAnyName

private boolean matchesAnyName
Quick flag denoting if the local name was '*'

prefix

private String prefix
Our prefix, bound through the current Context. The empty-string ("") if no prefix was specified. Decidedly NOT-NULL, due to SAXPath constraints. This is the 'foo' in 'foo:bar'.

serialVersionUID

private static final long serialVersionUID

Constructor Detail

DefaultNameStep

public DefaultNameStep(IterableAxis axis, String prefix, String localName, PredicateSet predicateSet)
Constructor.

Parameters: axis the axis to work through prefix the name prefix localName the local name predicateSet the set of predicates

Method Detail

evaluate

public List evaluate(Context context)
Evaluate the context node set to find the new node set.

This method overrides the version in DefaultStep for performance.

getLocalName

public String getLocalName()
Gets the local name.

Returns: the local name

getPrefix

public String getPrefix()
Gets the namespace prefix.

Returns: the prefix

getText

public String getText()
Gets the step as a fully defined XPath.

Returns: the full XPath for this step

hasNamespace

private boolean hasNamespace(String uri)
Checks whether the URI represents a namespace.

Parameters: uri the URI to check

Returns: true if non-null and non-empty

isMatchesAnyName

public boolean isMatchesAnyName()
Does this step match any name? (i.e. Is it '*'?)

Returns: true if it matches any name

matches

public boolean matches(Object node, ContextSupport contextSupport)
Checks whether the node matches this step.

Parameters: node the node to check contextSupport the context support

Returns: true if matches

Throws: JaxenException

matchesNamespaceURIs

protected boolean matchesNamespaceURIs(String uri1, String uri2)
Compares two namespace URIs, handling null.

Parameters: uri1 the first URI uri2 the second URI

Returns: true if equal, where null==""

toString

public String toString()
Returns a full information debugging string.

Returns: a debugging string