Class ConfigurationNodePointerFactory
- java.lang.Object
-
- org.apache.commons.configuration2.tree.xpath.ConfigurationNodePointerFactory
-
- All Implemented Interfaces:
org.apache.commons.jxpath.ri.model.NodePointerFactory
public class ConfigurationNodePointerFactory extends java.lang.Object implements org.apache.commons.jxpath.ri.model.NodePointerFactory
Implementation of the
NodePointerFactory
interface for configuration nodes.This class is able to create
NodePointer
s for the nodes of hierarchical configurations. Because there is no common base class for configuration nodes (any specific configuration implementation can use its own node class) a trick is needed for activating this factory for a concrete JXPath query: ThewrapNode()
method has to be called with the node object and its correspondingNodeHandler
. This creates a wrapper object containing all information required by the factory for processing a query. Then this wrapper object has to be passed to the query methods of the JXPath context.- Since:
- 1.3
- Version:
- $Id: ConfigurationNodePointerFactory.java 1790899 2017-04-10 21:56:46Z ggregory $
-
-
Field Summary
Fields Modifier and Type Field Description static int
CONFIGURATION_NODE_POINTER_FACTORY_ORDER
Constant for the order of this factory.
-
Constructor Summary
Constructors Constructor Description ConfigurationNodePointerFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.commons.jxpath.ri.model.NodePointer
createNodePointer(org.apache.commons.jxpath.ri.model.NodePointer parent, org.apache.commons.jxpath.ri.QName name, java.lang.Object bean)
Creates a node pointer for the specified bean.org.apache.commons.jxpath.ri.model.NodePointer
createNodePointer(org.apache.commons.jxpath.ri.QName name, java.lang.Object bean, java.util.Locale locale)
Creates a node pointer for the specified bean.int
getOrder()
Returns the order of this factory between other factories.static <T> java.lang.Object
wrapNode(T node, NodeHandler<T> handler)
Creates a node wrapper for the specified node and its handler.
-
-
-
Field Detail
-
CONFIGURATION_NODE_POINTER_FACTORY_ORDER
public static final int CONFIGURATION_NODE_POINTER_FACTORY_ORDER
Constant for the order of this factory.- See Also:
- Constant Field Values
-
-
Method Detail
-
getOrder
public int getOrder()
Returns the order of this factory between other factories.- Specified by:
getOrder
in interfaceorg.apache.commons.jxpath.ri.model.NodePointerFactory
- Returns:
- this order's factory
-
createNodePointer
public org.apache.commons.jxpath.ri.model.NodePointer createNodePointer(org.apache.commons.jxpath.ri.QName name, java.lang.Object bean, java.util.Locale locale)
Creates a node pointer for the specified bean. If the bean is a configuration node (indicated by a wrapper object), a corresponding pointer is returned.- Specified by:
createNodePointer
in interfaceorg.apache.commons.jxpath.ri.model.NodePointerFactory
- Parameters:
name
- the name of the nodebean
- the beanlocale
- the locale- Returns:
- a pointer for a configuration node if the bean is such a node
-
createNodePointer
public org.apache.commons.jxpath.ri.model.NodePointer createNodePointer(org.apache.commons.jxpath.ri.model.NodePointer parent, org.apache.commons.jxpath.ri.QName name, java.lang.Object bean)
Creates a node pointer for the specified bean. If the bean is a configuration node, a corresponding pointer is returned.- Specified by:
createNodePointer
in interfaceorg.apache.commons.jxpath.ri.model.NodePointerFactory
- Parameters:
parent
- the parent nodename
- the namebean
- the bean- Returns:
- a pointer for a configuration node if the bean is such a node
-
wrapNode
public static <T> java.lang.Object wrapNode(T node, NodeHandler<T> handler)
Creates a node wrapper for the specified node and its handler. This wrapper has to be passed to the JXPath context instead of the original node.- Type Parameters:
T
- the type of the node- Parameters:
node
- the nodehandler
- the corresponding node handler- Returns:
- a wrapper for this node
-
-