org.geotools.data.complex.filter
Class XPath

java.lang.Object
  extended by org.geotools.data.complex.filter.XPath

public class XPath
extends java.lang.Object

Utility class to evaluate XPath expressions against an Attribute instance, which may be any Attribute, whether it is simple, complex, a feature, etc.

At the difference of the Filter subsystem, which works against Attribute contents (for example to evaluate a comparison filter), the XPath subsystem, for which this class is the single entry point, works against Attribute instances. That is, the result of an XPath expression, if a single value, is an Attribtue, not the attribute content, or a List of Attributes, for instance.

Since:
2.4
Version:
$Id: XPath.java 35958 2010-07-28 08:20:20Z victortey $
Author:
Gabriel Roldan, Axios Engineering, Rini Angreani, Curtin University of Technology

Nested Class Summary
static class XPath.Step
           
static class XPath.StepList
           
 
Constructor Summary
XPath()
           
XPath(org.opengis.filter.FilterFactory ff, org.opengis.feature.FeatureFactory featureFactory)
           
 
Method Summary
 boolean isComplexType(XPath.StepList attrXPath, org.opengis.feature.type.AttributeDescriptor featureType)
           
 org.opengis.feature.Attribute set(org.opengis.feature.Attribute att, XPath.StepList xpath, java.lang.Object value, java.lang.String id, org.opengis.feature.type.AttributeType targetNodeType, boolean isXlinkRef, org.opengis.feature.type.AttributeDescriptor targetDescriptor, org.opengis.filter.expression.Expression sourceExpression)
           
 org.opengis.feature.Attribute set(org.opengis.feature.Attribute att, XPath.StepList xpath, java.lang.Object value, java.lang.String id, org.opengis.feature.type.AttributeType targetNodeType, boolean isXlinkRef, org.opengis.filter.expression.Expression sourceExpression)
          Sets the value of the attribute of att addressed by xpath and of type targetNodeType to be value with id id.
 void setFeatureFactory(org.opengis.feature.FeatureFactory featureFactory)
           
 void setFilterFactory(org.opengis.filter.FilterFactory ff)
           
static XPath.StepList steps(org.opengis.feature.type.AttributeDescriptor root, java.lang.String xpathExpression, org.xml.sax.helpers.NamespaceSupport namespaces)
          Returns the list of stepts in xpathExpression by cleaning it up removing unnecessary elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPath

public XPath()

XPath

public XPath(org.opengis.filter.FilterFactory ff,
             org.opengis.feature.FeatureFactory featureFactory)
Method Detail

setFilterFactory

public void setFilterFactory(org.opengis.filter.FilterFactory ff)

setFeatureFactory

public void setFeatureFactory(org.opengis.feature.FeatureFactory featureFactory)

steps

public static XPath.StepList steps(org.opengis.feature.type.AttributeDescriptor root,
                                   java.lang.String xpathExpression,
                                   org.xml.sax.helpers.NamespaceSupport namespaces)
                            throws java.lang.IllegalArgumentException
Returns the list of stepts in xpathExpression by cleaning it up removing unnecessary elements.

Parameters:
root - non null descriptor of the root attribute, generally the Feature descriptor. Used to ignore the first step in xpathExpression if the expression's first step is named as rootName.
xpathExpression -
Returns:
Throws:
java.lang.IllegalArgumentException - if xpathExpression has no steps or it isn't a valid XPath expression against type.

set

public org.opengis.feature.Attribute set(org.opengis.feature.Attribute att,
                                         XPath.StepList xpath,
                                         java.lang.Object value,
                                         java.lang.String id,
                                         org.opengis.feature.type.AttributeType targetNodeType,
                                         boolean isXlinkRef,
                                         org.opengis.filter.expression.Expression sourceExpression)
Sets the value of the attribute of att addressed by xpath and of type targetNodeType to be value with id id.

Parameters:
att - the root attribute for which to set the child attribute value
xpath - the xpath expression that addresses the att child whose value is to be set
value - the value of the attribute addressed by xpath
id - the identifier of the attribute addressed by xpath, might be null
targetNodeType - the expected type of the attribute addressed by xpath, or null if unknown
isXlinkRef - true if the attribute would only contain xlink:href client property
Returns:

set

public org.opengis.feature.Attribute set(org.opengis.feature.Attribute att,
                                         XPath.StepList xpath,
                                         java.lang.Object value,
                                         java.lang.String id,
                                         org.opengis.feature.type.AttributeType targetNodeType,
                                         boolean isXlinkRef,
                                         org.opengis.feature.type.AttributeDescriptor targetDescriptor,
                                         org.opengis.filter.expression.Expression sourceExpression)

isComplexType

public boolean isComplexType(XPath.StepList attrXPath,
                             org.opengis.feature.type.AttributeDescriptor featureType)


Copyright © 1996-2010 Geotools. All Rights Reserved.