public class RoleDiagnostic
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
AXIS_STEP |
static int |
BINARY_EXPR |
static int |
CHARACTER_MAP_EXPANSION |
static int |
CONTEXT_ITEM |
static int |
EVALUATE_RESULT |
static int |
FUNCTION |
static int |
FUNCTION_RESULT |
static int |
INSTRUCTION |
static int |
MATCH_PATTERN |
static int |
MISC |
static int |
OPTION |
static int |
ORDER_BY |
static int |
PARAM |
static int |
TEMPLATE_RESULT |
static int |
TYPE_OP |
static int |
UNARY_EXPR |
static int |
UPDATING_EXPR |
static int |
VARIABLE |
Constructor and Description |
---|
RoleDiagnostic(int kind,
java.lang.String operation,
int operand)
Create information about the role of a subexpression within its parent expression
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
composeErrorMessage(ItemType requiredItemType,
Expression supplied,
TypeHierarchy th)
Construct a full error message, containing the supplied expression (for use when
the error is reported statically)
|
java.lang.String |
composeErrorMessage(ItemType requiredItemType,
ItemType suppliedItemType)
Construct a full error message
|
java.lang.String |
composeErrorMessage(ItemType requiredItemType,
Item item,
TypeHierarchy th)
Construct a full error message, displaying the item in error (suitable for use when
a type error is reported dynamically)
|
java.lang.String |
composeErrorMessage(ItemType requiredItemType,
UType suppliedItemType)
Construct a full error message, in terms of UTypes
|
java.lang.String |
composeRequiredMessage(ItemType requiredItemType)
Construct the part of the message giving the required item type
|
java.lang.String |
getErrorCode()
Get the error code to be produced if a type error is detected
|
java.lang.String |
getMessage()
Construct and return the error message indicating a type error
|
boolean |
isTypeError()
Ask whether the error code represents a type error
|
static java.lang.String |
ordinal(int n)
Get the ordinal representation of a number (used to identify which argument of a function
is in error)
|
static RoleDiagnostic |
reconstruct(java.lang.String in)
Reconstruct from a saved string
|
java.lang.String |
save()
Save as a string, for use when serializing the expression tree
|
void |
setErrorCode(java.lang.String code)
Set the error code to be produced if a type error is detected
|
public static final int FUNCTION
public static final int BINARY_EXPR
public static final int TYPE_OP
public static final int VARIABLE
public static final int INSTRUCTION
public static final int FUNCTION_RESULT
public static final int ORDER_BY
public static final int TEMPLATE_RESULT
public static final int PARAM
public static final int UNARY_EXPR
public static final int UPDATING_EXPR
public static final int EVALUATE_RESULT
public static final int CONTEXT_ITEM
public static final int AXIS_STEP
public static final int OPTION
public static final int CHARACTER_MAP_EXPANSION
public static final int MATCH_PATTERN
public static final int MISC
public RoleDiagnostic(int kind, java.lang.String operation, int operand)
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. A QName is provided in display form, prefix:local.
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
a function callpublic void setErrorCode(java.lang.String code)
code
- The error codepublic java.lang.String getErrorCode()
public boolean isTypeError()
public java.lang.String getMessage()
public java.lang.String composeRequiredMessage(ItemType requiredItemType)
requiredItemType
- the item type required by the context of a particular expressionpublic java.lang.String composeErrorMessage(ItemType requiredItemType, ItemType suppliedItemType)
requiredItemType
- the item type required by the context of a particular expressionsuppliedItemType
- the item type inferred by static analysis of an expressionpublic java.lang.String composeErrorMessage(ItemType requiredItemType, Expression supplied, TypeHierarchy th)
requiredItemType
- the item type required by the context of a particular expressionsupplied
- the supplied expressionpublic java.lang.String composeErrorMessage(ItemType requiredItemType, Item item, TypeHierarchy th)
requiredItemType
- the item type required by the context of a particular expressionitem
- the actual item in error. Must NOT be null (unlike earlier releases).public java.lang.String composeErrorMessage(ItemType requiredItemType, UType suppliedItemType)
requiredItemType
- the item type required by the context of a particular expressionsuppliedItemType
- the item type inferred by static analysis of an expressionpublic java.lang.String save()
public static RoleDiagnostic reconstruct(java.lang.String in)
in
- the saved string representation of the RoleDiagnosticpublic static java.lang.String ordinal(int n)
n
- the cardinal numberCopyright (c) 2004-2020 Saxonica Limited. All rights reserved.