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});
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Constant 4static final int
Constant 10static final int
Constant 5static final int
Constant 2static final int
Constant 9static final int
Constant 13static final int
Constant 8static final int
Constant 11static final int
Constant 6static final int
Constant 3static final int
Constant 7static final int
Constant 12static final int
Constant 1static final int
Constant 18static final int
Constant 26static final int
Constant 9static final int
Constant 11static final int
Constant 3static final int
Constant 31static final int
Constant 21static final int
Constant 25static final int
Constant 30static final int
Constant 4static final int
Constant 29static final int
Constant 22static final int
Constant 1static final int
Constant 5static final int
Constant 7static final int
Constant 6static final int
Constant 16static final int
Constant 19static final int
Constant 28static final int
Constant 23static final int
Constant 2static final int
Constant 27static final int
Constant 10static final int
Constant 8static final int
Constant 15static final int
Constant 14static final int
Constant 13static final int
Constant 12static final int
Constant 24static final int
Constant 17static final int
Constant 20static final int
Constant 3static final int
Constant 1static final int
Constant 4static final int
Constant 2 -
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
Constant 1- See Also:
-
NODE_TYPE_TEXT
Constant 2- See Also:
-
NODE_TYPE_COMMENT
Constant 3- See Also:
-
NODE_TYPE_PI
Constant 4- See Also:
-
AXIS_SELF
Constant 1- See Also:
-
AXIS_CHILD
Constant 2- See Also:
-
AXIS_PARENT
Constant 3- See Also:
-
AXIS_ANCESTOR
Constant 4- See Also:
-
AXIS_ATTRIBUTE
Constant 5- See Also:
-
AXIS_NAMESPACE
Constant 6- See Also:
-
AXIS_PRECEDING
Constant 7- See Also:
-
AXIS_FOLLOWING
Constant 8- See Also:
-
AXIS_DESCENDANT
Constant 9- See Also:
-
AXIS_ANCESTOR_OR_SELF
Constant 10- See Also:
-
AXIS_FOLLOWING_SIBLING
Constant 11- See Also:
-
AXIS_PRECEDING_SIBLING
Constant 12- See Also:
-
AXIS_DESCENDANT_OR_SELF
Constant 13- See Also:
-
FUNCTION_LAST
Constant 1- See Also:
-
FUNCTION_POSITION
Constant 2- See Also:
-
FUNCTION_COUNT
Constant 3- See Also:
-
FUNCTION_ID
Constant 4- See Also:
-
FUNCTION_LOCAL_NAME
Constant 5- See Also:
-
FUNCTION_NAMESPACE_URI
Constant 6- See Also:
-
FUNCTION_NAME
Constant 7- See Also:
-
FUNCTION_STRING
Constant 8- See Also:
-
FUNCTION_CONCAT
Constant 9- See Also:
-
FUNCTION_STARTS_WITH
Constant 10- See Also:
-
FUNCTION_CONTAINS
Constant 11- See Also:
-
FUNCTION_SUBSTRING_BEFORE
Constant 12- See Also:
-
FUNCTION_SUBSTRING_AFTER
Constant 13- See Also:
-
FUNCTION_SUBSTRING
Constant 14- See Also:
-
FUNCTION_STRING_LENGTH
Constant 15- See Also:
-
FUNCTION_NORMALIZE_SPACE
Constant 16- See Also:
-
FUNCTION_TRANSLATE
Constant 17- See Also:
-
FUNCTION_BOOLEAN
Constant 18- See Also:
-
FUNCTION_NOT
Constant 19- See Also:
-
FUNCTION_TRUE
Constant 20- See Also:
-
FUNCTION_FALSE
Constant 21- See Also:
-
FUNCTION_LANG
Constant 22- See Also:
-
FUNCTION_NUMBER
Constant 23- See Also:
-
FUNCTION_SUM
Constant 24- See Also:
-
FUNCTION_FLOOR
Constant 25- See Also:
-
FUNCTION_CEILING
Constant 26- See Also:
-
FUNCTION_ROUND
Constant 27- See Also:
-
FUNCTION_NULL
Constant 28- See Also:
-
FUNCTION_KEY
Constant 29- See Also:
-
FUNCTION_FORMAT_NUMBER
Constant 30- See Also:
-
FUNCTION_ENDS_WITH
Constant 31- See Also:
-
-
Method Details
-
and
Produces an EXPRESSION object representing logical conjunction of all arguments- Parameters:
arguments
- are EXPRESSION objects- Returns:
- Object
-
divide
Produces an EXPRESSION object representing left divided by 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
-
expressionPath
Produces an EXPRESSION object representing a filter expression- Parameters:
expression
- is an EXPRESSION objectpredicates
- are EXPRESSION objectssteps
- are STEP objects- 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
-
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
-
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
-
literal
Produces an EXPRESSION object that represents a string constant.- Parameters:
value
- String literal- Returns:
- Object
-
locationPath
Produces an EXPRESSION object representing a location path- Parameters:
absolute
- indicates whether the path is absolutesteps
- are STEP objects- Returns:
- Object
-
minus
Produces an EXPRESSION object representing unary negation of the argument- Parameters:
argument
- is an EXPRESSION object- Returns:
- Object
-
minus
Produces an EXPRESSION object representing left minus 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
-
multiply
Produces an EXPRESSION object representing left multiplied by right- Parameters:
left
- is an EXPRESSION objectright
- is an EXPRESSION object- 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
-
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
-
number
Produces an EXPRESSION object that represents a numeric constant.- Parameters:
value
- numeric String- Returns:
- Object
-
or
Produces an EXPRESSION object representing logical disjunction of all arguments- Parameters:
arguments
- are EXPRESSION objects- Returns:
- Object
-
processingInstructionTest
Produces a NODE_TEST object that represents a processing instruction test.- Parameters:
instruction
- is a NODE_TEST object- Returns:
- Object
-
qname
Produces an QNAME that represents a name with an optional prefix.- Parameters:
prefix
- String prefixname
- String name- 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
-
sum
Produces an EXPRESSION object representing the sum of all argumens- 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
-
variableReference
Produces an EXPRESSION object representing variable reference- Parameters:
qname
- is a QNAME object- Returns:
- Object
-