org.jaxen.expr
Class DefaultNameStep

java.lang.Object
  extended byorg.jaxen.expr.DefaultStep
      extended byorg.jaxen.expr.DefaultNameStep
All Implemented Interfaces:
NameStep, Predicated, java.io.Serializable, Step, Visitable

public class DefaultNameStep
extends DefaultStep
implements NameStep

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
See Also:
Serialized Form

Constructor Summary
DefaultNameStep(IterableAxis axis, java.lang.String prefix, java.lang.String localName, PredicateSet predicateSet)
          Constructor.
 
Method Summary
 void accept(Visitor visitor)
          Visitor pattern for the step.
 java.util.List evaluate(Context context)
          Evaluate the context node set to find the new node set.
 java.lang.String getLocalName()
          Gets the local name.
 java.lang.String getPrefix()
          Gets the namespace prefix.
 java.lang.String getText()
          Gets the step as a fully defined xpath.
 boolean isMatchesAnyName()
          Does this step match any name (xpath of '*').
 boolean matches(java.lang.Object node, ContextSupport contextSupport)
          Checks whether the node matches this step.
protected  boolean matchesNamespaceURIs(java.lang.String uri1, java.lang.String uri2)
          Compares two namespace URIs, handling null.
 java.lang.String toString()
          Returns a full information debugging string.
 
Methods inherited from class org.jaxen.expr.DefaultStep
addPredicate, axisIterator, getAxis, getAxisName, getIterableAxis, getPredicates, getPredicateSet, simplify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jaxen.expr.Step
axisIterator, getAxis, simplify
 
Methods inherited from interface org.jaxen.expr.Predicated
addPredicate, getPredicates, getPredicateSet
 

Constructor Detail

DefaultNameStep

public DefaultNameStep(IterableAxis axis,
                       java.lang.String prefix,
                       java.lang.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

getPrefix

public java.lang.String getPrefix()
Gets the namespace prefix.

Specified by:
getPrefix in interface NameStep
Returns:
the prefix

getLocalName

public java.lang.String getLocalName()
Gets the local name.

Specified by:
getLocalName in interface NameStep
Returns:
the local name

isMatchesAnyName

public boolean isMatchesAnyName()
Does this step match any name (xpath of '*').

Returns:
true if it matches any name

getText

public java.lang.String getText()
Gets the step as a fully defined xpath.

Specified by:
getText in interface Step
Overrides:
getText in class DefaultStep
Returns:
the full xpath for this step

evaluate

public java.util.List evaluate(Context context)
                        throws JaxenException
Evaluate the context node set to find the new node set.

This method overrides the version in DefaultStep for performance.

Specified by:
evaluate in interface Step
Overrides:
evaluate in class DefaultStep
Throws:
JaxenException

matches

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

Specified by:
matches in interface Step
Parameters:
node - the node to check
contextSupport - the context support
Returns:
true if matches
Throws:
JaxenException

matchesNamespaceURIs

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

Parameters:
uri1 - the first URI
uri2 - the second URI
Returns:
true if equal, where null==""

accept

public void accept(Visitor visitor)
Visitor pattern for the step.

Specified by:
accept in interface Visitable
Parameters:
visitor - the visitor object

toString

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

Overrides:
toString in class DefaultStep
Returns:
a debugging string


Copyright © 2001-2005 Codehaus. All Rights Reserved.