summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2006-04-27 09:23:54 (EDT)
committer pelder2006-04-27 09:23:54 (EDT)
commit3ea8b7e4b8700a34a21de353504e0a230863c93f (patch)
treed3bad49a1d7e8f397ed9bb106efa77afd2dc159a
parentc481499db6acc2ccdf15fda57456cf7b964d90c0 (diff)
downloadorg.eclipse.jet-3ea8b7e4b8700a34a21de353504e0a230863c93f.zip
org.eclipse.jet-3ea8b7e4b8700a34a21de353504e0a230863c93f.tar.gz
org.eclipse.jet-3ea8b7e4b8700a34a21de353504e0a230863c93f.tar.bz2
[138904] Improve Javadoc, and explicitly declare throws of XPathRuntimeException
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/xpath/XPathExpression.java60
1 files changed, 54 insertions, 6 deletions
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/xpath/XPathExpression.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/xpath/XPathExpression.java
index 8122916..98254cd 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/xpath/XPathExpression.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/xpath/XPathExpression.java
@@ -24,16 +24,64 @@ package org.eclipse.jet.xpath;
public interface XPathExpression
{
- String evaluateAsString(Object contextObject);
+ /**
+ * Evaluate the expression and convert the result to a String using the XPath String function
+ * @param contextObject the context object for the expression
+ * @return the expression result.
+ * @throws XPathRuntimeException if an evaluation error occures
+ * @see link XPathUtil#xpathString(Object)
+ */
+ String evaluateAsString(Object contextObject) throws XPathRuntimeException;
- boolean evaluateAsBoolean(Object contextObject);
+ /**
+ * Evaluate the expression and convert the result to a boolean using the XPath boolean function.
+ * @param contextObject the context object for the expression
+ * @return the expression result.
+ * @throws XPathRuntimeException if an evaluation error occures
+ * @see XPathUtil#xpathBoolean(Object)
+ */
+ boolean evaluateAsBoolean(Object contextObject) throws XPathRuntimeException;
- double evaluateAsNumber(Object contextObject);
+ /**
+ * Evaluate the expression and convert the result to a number using the XPath number function.
+ * @param contextObject the context object for the expression.
+ * @return the expression result
+ * @throws XPathRuntimeException if an evaluation error occures
+ * @see XPathUtil#xpathNumber(Object)
+ */
+ double evaluateAsNumber(Object contextObject) throws XPathRuntimeException;
- NodeSet evaluateAsNodeSet(Object contextObject);
+ /**
+ * Evaluate the expression and return the result as a Node set. If the result cannot be converted to a
+ * node set, then an exception is thrown.
+ * @param contextObject the context object for the expression.
+ * @return the expression result
+ * @throws XPathRuntimeException if an evaluation error occures
+ */
+ NodeSet evaluateAsNodeSet(Object contextObject) throws XPathRuntimeException;
- Object evaluateAsSingleNode(Object contextObject);
+ /**
+ * Evaluate the expression using {@link #evaluateAsNodeSet(Object)} and then return the first object in
+ * the node set. An exception is thrown if the expression cannot be converted to a node set.
+ * If the resulting node set is empty, then null is returned.
+ * @param contextObject the context object for the expression.
+ * @return the first element in the node set or <code>null</code> if the node set is empty.
+ * @throws XPathRuntimeException if an evaluation error occures
+ */
+ Object evaluateAsSingleNode(Object contextObject) throws XPathRuntimeException;
- Object evaluate(Object contextObject);
+ /**
+ * Evaluate the expression and return the 'natural' result of the expression. The result may be any of:
+ * <ul>
+ * <li>{@link String}</li>
+ * <li>{@link Boolean}</li>
+ * <li>{@link Number}</li>
+ * <li>{@link NodeSet}</li>
+ * </ul>
+ * @param contextObject the context object for the expression.
+ * @return the expression result
+ * @throws XPathRuntimeException if an evaluation error occures
+ */
+ Object evaluate(Object contextObject) throws XPathRuntimeException;
}