org.plasma.sdo.xpath
Class MetaDataXPath

java.lang.Object
  extended by org.jaxen.BaseXPath
      extended by org.plasma.sdo.xpath.DefaultXPath
          extended by org.plasma.sdo.xpath.MetaDataXPath
All Implemented Interfaces:
Serializable, org.jaxen.XPath

public class MetaDataXPath
extends DefaultXPath

An XPath implementation for traversal of an SDO Type graph based on Jaxen.

This is the main entry point for matching an XPath against a set of Type structures linked by properties.

Predicates typically involve data as well as "meta data". E.g. /person/[@name='Sam'] where 'Sam' is data and 'person' and 'name' are meta data. This class accepts only SDO meta data objects such as Type as input and therefore assumes a given XPath references only meta data elements. Passing an XPath expression with data elements will result in zero or null results returned. Use DataGraphXPath to process mixed data and meta data XPath expressions.

See Also:
Serialized Form

Constructor Summary
MetaDataXPath(String xpathExpr)
           
MetaDataXPath(String xpathExpr, org.jaxen.Navigator navigator)
           
 
Method Summary
 XPathProperty[] findProperties(Type root)
          Returns an array of Property results, an error being thrown if other than Property results are found.
 XPathProperty findProperty(Type root)
          Returns a single Property result or null if no Property results are found.
 org.jaxen.Context getNodeContext(Object node)
           
 XPathProperty getProperty(Type root)
          Returns a single Property result.
 MetaDataNodeAdapter[] getResults(Type root)
          Returns an array with either 1 single result or multiple results, and error being thrown if no results are found or if multiple results are found but the target Property is not a "many" Property, i.e.
 
Methods inherited from class org.plasma.sdo.xpath.DefaultXPath
isXPath
 
Methods inherited from class org.jaxen.BaseXPath
addNamespace, booleanValueOf, createFunctionContext, createNamespaceContext, createVariableContext, debug, evaluate, getContext, getContextSupport, getFunctionContext, getNamespaceContext, getNavigator, getRootExpr, getVariableContext, numberValueOf, selectNodes, selectNodesForContext, selectSingleNode, selectSingleNodeForContext, setFunctionContext, setNamespaceContext, setVariableContext, stringValueOf, toString, valueOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MetaDataXPath

public MetaDataXPath(String xpathExpr)
              throws org.jaxen.JaxenException
Throws:
org.jaxen.JaxenException

MetaDataXPath

public MetaDataXPath(String xpathExpr,
                     org.jaxen.Navigator navigator)
              throws org.jaxen.JaxenException
Throws:
org.jaxen.JaxenException
Method Detail

getNodeContext

public org.jaxen.Context getNodeContext(Object node)

getResults

public MetaDataNodeAdapter[] getResults(Type root)
                                 throws org.jaxen.JaxenException,
                                        InvalidMultiplicityException
Returns an array with either 1 single result or multiple results, and error being thrown if no results are found or if multiple results are found but the target Property is not a "many" Property, i.e. a multi-valued Property. The target Property is the result or end point Property after resolving an XPATH.

Returns:
an array with either 1 single result or multiple results.
Throws:
IllegalXPathArgumentException - if no results are found or if multiple results are found but the target Property is not a "many" property, i.e. a multi-valued Property. The target Property is the result or end point Property after resolving an XPATH.
org.jaxen.JaxenException - as required by the Jaxen API
InvalidMultiplicityException - if the given XPATH resulted in multiple values for a singular property

findProperties

public XPathProperty[] findProperties(Type root)
                               throws org.jaxen.JaxenException,
                                      InvalidEndpointException
Returns an array of Property results, an error being thrown if other than Property results are found.

Parameters:
root - the SDO Type root
Returns:
an array of Property results or zero length array if no results are found.
Throws:
org.jaxen.JaxenException - as required by the Jaxen API
InvalidEndpointException - when the result or terminating node or nodes are not Property nodes

getProperty

public XPathProperty getProperty(Type root)
                          throws org.jaxen.JaxenException,
                                 InvalidEndpointException
Returns a single Property result.

Parameters:
root - the SDO Type root
Returns:
an array of Property results or zero length array if no results are found.
Throws:
org.jaxen.JaxenException - as required by the Jaxen API
InvalidEndpointException - when the result or terminating node or nodes are not Property nodes or if no result is found.

findProperty

public XPathProperty findProperty(Type root)
                           throws org.jaxen.JaxenException,
                                  InvalidEndpointException
Returns a single Property result or null if no Property results are found.

Parameters:
root - the SDO Type root
Returns:
an array of Property results or null if no results are found.
Throws:
org.jaxen.JaxenException - as required by the Jaxen API
InvalidEndpointException - when the result or terminating node or nodes are not Property nodes


Copyright © 2014. All rights reserved.