Package net.sf.saxon.expr
Class RoleLocator
java.lang.Object
net.sf.saxon.expr.RoleLocator
- All Implemented Interfaces:
Serializable
A RoleLocator identifies the role in which an expression is used, for example as
the third argument of the concat() function. This information is stored in an
ItemChecker or CardinalityChecker so that good diagnostics can be
achieved when run-time type errors are detected.
- See Also:
-
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
-
Constructor Summary
ConstructorsConstructorDescriptionRoleLocator
(int kind, Serializable operation, int operand) Create information about the role of a subexpression within its parent expression -
Method Summary
Modifier and TypeMethodDescriptioncomposeErrorMessage
(ItemType requiredItemType, ItemType suppliedItemType, NamePool pool) Construct a full error messagecomposeRequiredMessage
(ItemType requiredItemType, NamePool pool) Construct the part of the message giving the required item typeGet the error code to be produced if a type error is detectedConstruct and return the error message indicating a type errorvoid
setErrorCode
(String code) Set the error code to be produced if a type error is detected
-
Field Details
-
FUNCTION
public static final int FUNCTION- See Also:
-
BINARY_EXPR
public static final int BINARY_EXPR- See Also:
-
TYPE_OP
public static final int TYPE_OP- See Also:
-
VARIABLE
public static final int VARIABLE- See Also:
-
INSTRUCTION
public static final int INSTRUCTION- See Also:
-
FUNCTION_RESULT
public static final int FUNCTION_RESULT- See Also:
-
ORDER_BY
public static final int ORDER_BY- See Also:
-
TEMPLATE_RESULT
public static final int TEMPLATE_RESULT- See Also:
-
PARAM
public static final int PARAM- See Also:
-
UNARY_EXPR
public static final int UNARY_EXPR- See Also:
-
UPDATING_EXPR
public static final int UPDATING_EXPR- See Also:
-
-
Constructor Details
-
RoleLocator
Create information about the role of a subexpression within its parent expression- Parameters:
kind
- the kind of parent expression, e.g. a function call or a variable referenceoperation
- the name of the object in the parent expression, e.g. a function name or instruction name. May be expressed either as a String or as aStructuredQName
. For a string, the special format element/attribute is recognized, for example xsl:for-each/select, to identify the role of an XPath expression in a stylesheet.operand
- Ordinal position of this subexpression, e.g. the position of an argument in
-
-
Method Details
-
setErrorCode
Set the error code to be produced if a type error is detected- Parameters:
code
- The error code
-
getErrorCode
Get the error code to be produced if a type error is detected- Returns:
- code The error code
-
getMessage
Construct and return the error message indicating a type error- Returns:
- the constructed error message
-
composeRequiredMessage
Construct the part of the message giving the required item type- Parameters:
requiredItemType
- the item type required by the context of a particular expressionpool
- the name pool- Returns:
- a message of the form "Required item type of X is Y"
-
composeErrorMessage
public String composeErrorMessage(ItemType requiredItemType, ItemType suppliedItemType, NamePool pool) Construct a full error message- Parameters:
requiredItemType
- the item type required by the context of a particular expressionsuppliedItemType
- the item type inferred by static analysis of an expressionpool
- the name pool- Returns:
- a message of the form "Required item type of A is R; supplied value has item type S"
-