Package org.apache.commons.jxpath.ri
Interface Compiler
- All Known Implementing Classes:
TreeCompiler
public interface Compiler
The Compiler APIs are completely agnostic to the actual types of objects
produced and consumed by the APIs. Arguments and return values are
declared as java.lang.Object.
Since objects returned by Compiler methods are passed as arguments to other Compiler methods, the descriptions of these methods use virtual types. There are four virtual object types: EXPRESSION, QNAME, STEP and NODE_TEST.
The following example illustrates this notion. This sequence compiles the xpath "foo[round(1 div 2)]/text()":
Object qname1 = compiler.qname(null, "foo") Object expr1 = compiler.number("1"); Object expr2 = compiler.number("2"); Object expr3 = compiler.div(expr1, expr2); Object expr4 = compiler. coreFunction(Compiler.FUNCTION_ROUND, new Object[]{expr3}); Object test1 = compiler.nodeNameTest(qname1); Object step1 = compiler. step(Compiler.AXIS_CHILD, test1, new Object[]{expr4}); Object test2 = compiler.nodeTypeTest(Compiler.NODE_TYPE_TEXT); Object step2 = compiler.nodeTypeTest(Compiler.AXIS_CHILD, test2, null); Object expr5 = compiler.locationPath(false, new Object[]{step1, step2});
- Version:
- $Revision: 652845 $ $Date: 2008-05-02 12:46:46 -0500 (Fri, 02 May 2008) $
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Method Summary
Modifier and TypeMethodDescriptionProduces an EXPRESSION object representing logical conjunction of all argumentsProduces an EXPRESSION object representing left divided by rightProduces an EXPRESSION object representing the comparison: left equals to rightexpressionPath
(Object expression, Object[] predicates, Object[] steps) Produces an EXPRESSION object representing a filter expressionProduces an EXPRESSION object representing the computation of a core function with the supplied arguments.Produces an EXPRESSION object representing the computation of a library function with the supplied arguments.greaterThan
(Object left, Object right) Produces an EXPRESSION object representing the comparison: left greater than rightgreaterThanOrEqual
(Object left, Object right) Produces an EXPRESSION object representing the comparison: left greater than or equal to rightProduces an EXPRESSION object representing the comparison: left less than rightlessThanOrEqual
(Object left, Object right) Produces an EXPRESSION object representing the comparison: left less than or equal to rightProduces an EXPRESSION object that represents a string constant.locationPath
(boolean absolute, Object[] steps) Produces an EXPRESSION object representing a location pathProduces an EXPRESSION object representing unary negation of the argumentProduces an EXPRESSION object representing left minus rightProduces an EXPRESSION object representing left modulo rightProduces an EXPRESSION object representing left multiplied by rightnodeNameTest
(Object qname) Produces a NODE_TEST object that represents a node name test.nodeTypeTest
(int nodeType) Produces a NODE_TEST object that represents a node type test.Produces an EXPRESSION object representing the comparison: left is not equal to rightProduces an EXPRESSION object that represents a numeric constant.Produces an EXPRESSION object representing logical disjunction of all argumentsprocessingInstructionTest
(String instruction) Produces a NODE_TEST object that represents a processing instruction test.Produces an QNAME that represents a name with an optional prefix.Produces a STEP object that represents a node test.Produces an EXPRESSION object representing the sum of all argumensProduces an EXPRESSION object representing union of all node setsvariableReference
(Object qname) Produces an EXPRESSION object representing variable reference
-
Field Details
-
NODE_TYPE_NODE
static final int NODE_TYPE_NODE- See Also:
-
NODE_TYPE_TEXT
static final int NODE_TYPE_TEXT- See Also:
-
NODE_TYPE_COMMENT
static final int NODE_TYPE_COMMENT- See Also:
-
NODE_TYPE_PI
static final int NODE_TYPE_PI- See Also:
-
AXIS_SELF
static final int AXIS_SELF- See Also:
-
AXIS_CHILD
static final int AXIS_CHILD- See Also:
-
AXIS_PARENT
static final int AXIS_PARENT- See Also:
-
AXIS_ANCESTOR
static final int AXIS_ANCESTOR- See Also:
-
AXIS_ATTRIBUTE
static final int AXIS_ATTRIBUTE- See Also:
-
AXIS_NAMESPACE
static final int AXIS_NAMESPACE- See Also:
-
AXIS_PRECEDING
static final int AXIS_PRECEDING- See Also:
-
AXIS_FOLLOWING
static final int AXIS_FOLLOWING- See Also:
-
AXIS_DESCENDANT
static final int AXIS_DESCENDANT- See Also:
-
AXIS_ANCESTOR_OR_SELF
static final int AXIS_ANCESTOR_OR_SELF- See Also:
-
AXIS_FOLLOWING_SIBLING
static final int AXIS_FOLLOWING_SIBLING- See Also:
-
AXIS_PRECEDING_SIBLING
static final int AXIS_PRECEDING_SIBLING- See Also:
-
AXIS_DESCENDANT_OR_SELF
static final int AXIS_DESCENDANT_OR_SELF- See Also:
-
FUNCTION_LAST
static final int FUNCTION_LAST- See Also:
-
FUNCTION_POSITION
static final int FUNCTION_POSITION- See Also:
-
FUNCTION_COUNT
static final int FUNCTION_COUNT- See Also:
-
FUNCTION_ID
static final int FUNCTION_ID- See Also:
-
FUNCTION_LOCAL_NAME
static final int FUNCTION_LOCAL_NAME- See Also:
-
FUNCTION_NAMESPACE_URI
static final int FUNCTION_NAMESPACE_URI- See Also:
-
FUNCTION_NAME
static final int FUNCTION_NAME- See Also:
-
FUNCTION_STRING
static final int FUNCTION_STRING- See Also:
-
FUNCTION_CONCAT
static final int FUNCTION_CONCAT- See Also:
-
FUNCTION_STARTS_WITH
static final int FUNCTION_STARTS_WITH- See Also:
-
FUNCTION_CONTAINS
static final int FUNCTION_CONTAINS- See Also:
-
FUNCTION_SUBSTRING_BEFORE
static final int FUNCTION_SUBSTRING_BEFORE- See Also:
-
FUNCTION_SUBSTRING_AFTER
static final int FUNCTION_SUBSTRING_AFTER- See Also:
-
FUNCTION_SUBSTRING
static final int FUNCTION_SUBSTRING- See Also:
-
FUNCTION_STRING_LENGTH
static final int FUNCTION_STRING_LENGTH- See Also:
-
FUNCTION_NORMALIZE_SPACE
static final int FUNCTION_NORMALIZE_SPACE- See Also:
-
FUNCTION_TRANSLATE
static final int FUNCTION_TRANSLATE- See Also:
-
FUNCTION_BOOLEAN
static final int FUNCTION_BOOLEAN- See Also:
-
FUNCTION_NOT
static final int FUNCTION_NOT- See Also:
-
FUNCTION_TRUE
static final int FUNCTION_TRUE- See Also:
-
FUNCTION_FALSE
static final int FUNCTION_FALSE- See Also:
-
FUNCTION_LANG
static final int FUNCTION_LANG- See Also:
-
FUNCTION_NUMBER
static final int FUNCTION_NUMBER- See Also:
-
FUNCTION_SUM
static final int FUNCTION_SUM- See Also:
-
FUNCTION_FLOOR
static final int FUNCTION_FLOOR- See Also:
-
FUNCTION_CEILING
static final int FUNCTION_CEILING- See Also:
-
FUNCTION_ROUND
static final int FUNCTION_ROUND- See Also:
-
FUNCTION_NULL
static final int FUNCTION_NULL- See Also:
-
FUNCTION_KEY
static final int FUNCTION_KEY- See Also:
-
FUNCTION_FORMAT_NUMBER
static final int FUNCTION_FORMAT_NUMBER- See Also:
-
-
Method Details
-
number
Produces an EXPRESSION object that represents a numeric constant.- Parameters:
value
- numeric String- Returns:
- Object
-
literal
Produces an EXPRESSION object that represents a string constant.- Parameters:
value
- String literal- Returns:
- Object
-
qname
Produces an QNAME that represents a name with an optional prefix.- Parameters:
prefix
- String prefixname
- String name- Returns:
- Object
-
sum
Produces an EXPRESSION object representing the sum of all argumens- Parameters:
arguments
- are EXPRESSION objects- Returns:
- Object
-
minus
Produces an EXPRESSION object representing left minus right- Parameters:
left
- is an EXPRESSION objectright
- is an EXPRESSION object- Returns:
- Object
-
multiply
Produces an EXPRESSION object representing left multiplied by right- Parameters:
left
- is an EXPRESSION objectright
- is an EXPRESSION object- Returns:
- Object
-
divide
Produces an EXPRESSION object representing left divided by right- Parameters:
left
- is an EXPRESSION objectright
- is an EXPRESSION object- Returns:
- Object
-
mod
Produces an EXPRESSION object representing left modulo right- Parameters:
left
- is an EXPRESSION objectright
- is an EXPRESSION object- Returns:
- Object
-
lessThan
Produces an EXPRESSION object representing the comparison: left less than right- Parameters:
left
- is an EXPRESSION objectright
- is an EXPRESSION object- Returns:
- Object
-
lessThanOrEqual
Produces an EXPRESSION object representing the comparison: left less than or equal to right- Parameters:
left
- is an EXPRESSION objectright
- is an EXPRESSION object- Returns:
- Object
-
greaterThan
Produces an EXPRESSION object representing the comparison: left greater than right- Parameters:
left
- is an EXPRESSION objectright
- is an EXPRESSION object- Returns:
- Object
-
greaterThanOrEqual
Produces an EXPRESSION object representing the comparison: left greater than or equal to right- Parameters:
left
- is an EXPRESSION objectright
- is an EXPRESSION object- Returns:
- Object
-
equal
Produces an EXPRESSION object representing the comparison: left equals to right- Parameters:
left
- is an EXPRESSION objectright
- is an EXPRESSION object- Returns:
- Object
-
notEqual
Produces an EXPRESSION object representing the comparison: left is not equal to right- Parameters:
left
- is an EXPRESSION objectright
- is an EXPRESSION object- Returns:
- Object
-
minus
Produces an EXPRESSION object representing unary negation of the argument- Parameters:
argument
- is an EXPRESSION object- Returns:
- Object
-
variableReference
Produces an EXPRESSION object representing variable reference- Parameters:
qname
- is a QNAME object- Returns:
- Object
-
function
Produces an EXPRESSION object representing the computation of a core function with the supplied arguments.- Parameters:
code
- is one of FUNCTION_... constantsargs
- are EXPRESSION objects- Returns:
- Object
-
function
Produces an EXPRESSION object representing the computation of a library function with the supplied arguments.- Parameters:
name
- is a QNAME object (function name)args
- are EXPRESSION objects- Returns:
- Object
-
and
Produces an EXPRESSION object representing logical conjunction of all arguments- Parameters:
arguments
- are EXPRESSION objects- Returns:
- Object
-
or
Produces an EXPRESSION object representing logical disjunction of all arguments- Parameters:
arguments
- are EXPRESSION objects- Returns:
- Object
-
union
Produces an EXPRESSION object representing union of all node sets- Parameters:
arguments
- are EXPRESSION objects- Returns:
- Object
-
nodeNameTest
Produces a NODE_TEST object that represents a node name test.- Parameters:
qname
- is a QNAME object- Returns:
- Object
-
nodeTypeTest
Produces a NODE_TEST object that represents a node type test.- Parameters:
nodeType
- is a NODE_TEST object- Returns:
- Object
-
processingInstructionTest
Produces a NODE_TEST object that represents a processing instruction test.- Parameters:
instruction
- is a NODE_TEST object- Returns:
- Object
-
step
Produces a STEP object that represents a node test.- Parameters:
axis
- is one of the AXIS_... constantsnodeTest
- is a NODE_TEST objectpredicates
- are EXPRESSION objects- Returns:
- Object
-
locationPath
Produces an EXPRESSION object representing a location path- Parameters:
absolute
- indicates whether the path is absolutesteps
- are STEP objects- Returns:
- Object
-
expressionPath
Produces an EXPRESSION object representing a filter expression- Parameters:
expression
- is an EXPRESSION objectpredicates
- are EXPRESSION objectssteps
- are STEP objects- Returns:
- Object
-