01: package org.geotools.feature.iso.xpath;
02:
03: import java.util.Locale;
04:
05: import org.apache.commons.jxpath.ri.QName;
06: import org.apache.commons.jxpath.ri.model.NodePointer;
07: import org.apache.commons.jxpath.ri.model.NodePointerFactory;
08: import org.opengis.feature.Attribute;
09: import org.opengis.feature.type.AttributeType;
10:
11: /**
12: * A node factory which creates special node pointers featurs.
13: * <p>
14: * The following types are supported:
15: * <ul>
16: * <li>{@link Attribute}
17: * <li>{@link AttributeType}
18: * </ul>
19: * </p>
20: *
21: * @author Justin Deoliveira, The Open Planning Project
22: * @author Gabriel Roldan, Axios Engineering
23: *
24: */
25: public class AttributeNodePointerFactory implements NodePointerFactory {
26:
27: public int getOrder() {
28: return 0;
29: }
30:
31: public NodePointer createNodePointer(QName name, Object object,
32: Locale locale) {
33:
34: if (object instanceof Attribute) {
35: return new AttributeNodePointer(null, (Attribute) object,
36: name);
37: }
38:
39: /*
40: * if (object instanceof AttributeType) { return new
41: * FeatureTypePointer(null, (AttributeType) object, name); }
42: */
43:
44: return null;
45: }
46:
47: public NodePointer createNodePointer(NodePointer parent,
48: QName name, Object object) {
49:
50: if (object instanceof Attribute) {
51: return new AttributeNodePointer(parent, (Attribute) object,
52: name);
53: }
54:
55: /*
56: * if (object instanceof AttributeType) { return new
57: * FeatureTypePointer(null, (AttributeType) object, name); }
58: */
59:
60: return null;
61: }
62:
63: }
|