Package org.jaxen
Class Context
- java.lang.Object
-
- org.jaxen.Context
-
- All Implemented Interfaces:
java.io.Serializable
public class Context extends java.lang.Object implements java.io.Serializable
Wrapper around implementation-specific objects used as the context of an expression evaluation.NOTE: This class is not typically used directly, but is exposed for writers of implementation-specific XPath packages.
The
Context
bundles utilities together for evaluation of the expression. It wraps the provided objects for ease-of-passage through the expression AST.
-
-
Field Summary
Fields Modifier and Type Field Description private ContextSupport
contextSupport
Context-supportprivate java.util.List
nodeSet
Context node-setprivate int
position
Current context positionprivate static long
serialVersionUID
private int
size
Current context size
-
Constructor Summary
Constructors Constructor Description Context(ContextSupport contextSupport)
Create a new context.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Context
duplicate()
Create a type-safe shallow copy.ContextSupport
getContextSupport()
Retrieve theContextSupport
.Function
getFunction(java.lang.String namespaceURI, java.lang.String prefix, java.lang.String localName)
Retrieve aFunction
.Navigator
getNavigator()
Retrieve the currentNavigator
.java.util.List
getNodeSet()
Retrieve the context node-set.int
getPosition()
Retrieve current position in the context node-set.int
getSize()
Retrieve the size of the current context node-set.java.lang.Object
getVariableValue(java.lang.String namespaceURI, java.lang.String prefix, java.lang.String localName)
Retrieve a variable value.void
setContextSupport(ContextSupport contextSupport)
Set theContextSupport
.void
setNodeSet(java.util.List nodeSet)
Set the context node-set, and sets the current context size to the size of this node-set.void
setPosition(int position)
Set the current position in the context node-set.void
setSize(int size)
Set the current size in the context node-set.java.lang.String
translateNamespacePrefixToUri(java.lang.String prefix)
Translate a namespace prefix to its URI.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
contextSupport
private ContextSupport contextSupport
Context-support
-
nodeSet
private java.util.List nodeSet
Context node-set
-
size
private int size
Current context size
-
position
private int position
Current context position
-
-
Constructor Detail
-
Context
public Context(ContextSupport contextSupport)
Create a new context.- Parameters:
contextSupport
- the context-support
-
-
Method Detail
-
setNodeSet
public void setNodeSet(java.util.List nodeSet)
Set the context node-set, and sets the current context size to the size of this node-set.
The actual list is stored in this object. A copy is not made. This list should not be modified in other code after calling this method.
After invoking this method, the client should immediately call
setSize
andsetPosition
.- Parameters:
nodeSet
- the context node-set
-
getNodeSet
public java.util.List getNodeSet()
Retrieve the context node-set. This is a live list. It is not a copy. Do not modify it.- Returns:
- the context node-set
-
setContextSupport
public void setContextSupport(ContextSupport contextSupport)
Set theContextSupport
.- Parameters:
contextSupport
- the context-support
-
getContextSupport
public ContextSupport getContextSupport()
Retrieve theContextSupport
.- Returns:
- the context-support
-
getNavigator
public Navigator getNavigator()
Retrieve the currentNavigator
.- Returns:
- the navigator
-
translateNamespacePrefixToUri
public java.lang.String translateNamespacePrefixToUri(java.lang.String prefix)
Translate a namespace prefix to its URI.- Parameters:
prefix
- the prefix- Returns:
- the namespace URI mapped to the prefix
-
getVariableValue
public java.lang.Object getVariableValue(java.lang.String namespaceURI, java.lang.String prefix, java.lang.String localName) throws UnresolvableException
Retrieve a variable value.- Parameters:
namespaceURI
- the function namespace URIprefix
- the function prefixlocalName
- the function name- Returns:
- the variable value
- Throws:
UnresolvableException
- if unable to locate a bound variable
-
getFunction
public Function getFunction(java.lang.String namespaceURI, java.lang.String prefix, java.lang.String localName) throws UnresolvableException
Retrieve aFunction
.- Parameters:
namespaceURI
- the function namespace URIprefix
- the function prefixlocalName
- the function name- Returns:
- the function object
- Throws:
UnresolvableException
- if unable to locate a bound function
-
setSize
public void setSize(int size)
Set the current size in the context node-set.- Parameters:
size
- the size
-
getSize
public int getSize()
Retrieve the size of the current context node-set.- Returns:
- the size
-
setPosition
public void setPosition(int position)
Set the current position in the context node-set.- Parameters:
position
- the position
-
getPosition
public int getPosition()
Retrieve current position in the context node-set.- Returns:
- the current position
-
duplicate
public Context duplicate()
Create a type-safe shallow copy.- Returns:
- the duplicate
-
-