org.eclipse.jet.xpath.inspector
Interface INodeInspector
-
All Known Subinterfaces:
-
IElementInspector
-
public interface INodeInspector
Interface providing the XPath parser with information on a particular object. An inspector is specific
to classes of a particular Java type. The inspector will only receive objects of the types for which it is registered.
Inspectors may be manually registered via
InspectorManager.registerInspector(Class[], Class)
, or via the
org.eclipse.jet.modelInsecptors
extension point.
An inspector's responsibilies are
Map each received object to one of the XPath node kinds, as defined in
INodeInspector.NodeKind
.
For any given object,
getNodeKind(Object)
should always return the same value.
Implement the inspector functions consistently with the XPath 1.0 data model node to which the object is mapped.
An inspector may choose to implement the following extension interfaces:
INodeInspectorExtension1
- to provide name-based searching of children. This optional extension may provide
efficient resolution of name-based XPath navigations such as $x/foo
.
IElementInspector
- provide extra information for objects that are mapped to XPath Elements. This interface must
be implemented if the node inspector's implementation of
getNodeKind(Object)
returns
INodeInspector.NodeKind.ELEMENT
.
Nested Class Summary
|
static class
|
INodeInspector.NodeKind
A type safe enumeration of node kinds recognized by the JET XPath engine. |
Method Summary
|
ExpandedName
|
expandedNameOf
(java.lang.Object node)
Return the expanded name of the node. |
java.lang.Object[]
|
getChildren
(java.lang.Object node)
Return the child nodes of the context node. |
java.lang.Object
|
getDocumentRoot
(java.lang.Object node)
Return the document root for the contenxt node. |
INodeInspector.NodeKind
|
getNodeKind
(java.lang.Object obj)
Return the XPath node kind of the passed object. |
java.lang.Object
|
getParent
(java.lang.Object obj)
Return the parent of the passed object |
java.lang.String
|
nameOf
(java.lang.Object node)
Return the 'name' of the node. |
java.lang.String
|
stringValueOf
(java.lang.Object node)
Return the string value of the passed node. |
boolean
|
testExpandedName
(java.lang.Object node,
ExpandedName testName)
Determine whether the name of the node matches the passed expanded name. |
getNodeKind
INodeInspector.NodeKind getNodeKind(java.lang.Object obj)
- Return the XPath node kind of the passed object.
-
-
Parameters:
-
obj
- an object to inspect. Will not be null
.
-
Returns:
- the node kind. May be
null
if not recognized.
getParent
java.lang.Object getParent(java.lang.Object obj)
- Return the parent of the passed object
-
-
Parameters:
-
obj
- an object, will not be null
.
-
Returns:
- the parent, which may be
null
.
stringValueOf
java.lang.String stringValueOf(java.lang.Object node)
- Return the string value of the passed node.
-
-
Parameters:
-
node
- the node. Will not be null
.
-
Returns:
- the string value. Will not be
null
, but may be the empty string.
expandedNameOf
ExpandedName expandedNameOf(java.lang.Object node)
- Return the expanded name of the node.
-
-
Parameters:
-
node
- a node from which an expanded name is sought
-
Returns:
- an ExpandedName instance, or
null
if the node has not expanded name.
testExpandedName
boolean testExpandedName(java.lang.Object node,
ExpandedName testName)
- Determine whether the name of the node matches the passed expanded name.
-
-
Parameters:
-
testName
- an expanded name
-
Returns:
-
true
if there is a match, false
otherwise.
getDocumentRoot
java.lang.Object getDocumentRoot(java.lang.Object node)
- Return the document root for the contenxt node.
-
-
Parameters:
-
node
- the node. Will not be null
.
-
Returns:
- the document root, or
null
if a root cannot be determined.
getChildren
java.lang.Object[] getChildren(java.lang.Object node)
- Return the child nodes of the context node.
-
-
Parameters:
-
node
- the node. Will not be null
.
-
Returns:
- a possibly empty array of objects. Will not be
null
.
nameOf
java.lang.String nameOf(java.lang.Object node)
- Return the 'name' of the node.
-
-
Parameters:
-
node
-
-
Returns:
- the 'name' of the node, of
null
if the node has no name.