Class Callback


  • public class Callback
    extends java.lang.Object
    A convenient place to put static methods that will be called from generated byte code
    • Constructor Detail

      • Callback

        public Callback()
    • Method Detail

      • makeMessageFromTemplate

        public static java.lang.String makeMessageFromTemplate​(java.lang.String messageTemplate,
                                                               java.lang.Object param0)
        Expand a message template containing one variable string
        Parameters:
        messageTemplate - the message template in which a placeholder for the inserted string is indicated by the characters "{$1}"
        param0 - the variable string to be inserted into the message
        Returns:
        the expanded message
      • makeNonComparableException

        public static XPathException makeNonComparableException​(AtomicValue av0,
                                                                AtomicValue av1,
                                                                java.lang.String systemId,
                                                                int lineNumber)
        Construct (but don't throw) an exception reporting that two atomic values are not comparable
        Parameters:
        av0 - the first atomic value
        av1 - the second atomic value
        systemId - the module containing the comparison
        lineNumber - the line number of the comparison within this module
        Returns:
        the exception reporting the error
      • makeXmlNamespaceException

        public static XPathException makeXmlNamespaceException​(java.lang.String prefix,
                                                               java.lang.String namespace,
                                                               boolean isXSLT,
                                                               java.lang.String systemId,
                                                               int lineNumber)
        Construct (but do not throw) an exception reporting that the namespace prefix "xml" and the XML namespace URI can only be used as a pair
        Parameters:
        prefix - the prefix that was actually used
        namespace - the namespace URI that was actually used
        isXSLT - true if this is XSLT code, false if XQuery (affects the error code produced)
        systemId - the module in which the error occurred
        lineNumber - the line number where the error occurred
        Returns:
        the exception reporting the error condition
      • makeJavaInvocationException

        public static XPathException makeJavaInvocationException​(java.lang.Exception err,
                                                                 JavaExtensionFunctionCall call)
        Construct (but do not throw) an exception wrapping an exception thrown by a Java extension function
        Parameters:
        err - the exception thrown by the called extension function
        call - the extension function call in which the error occurred
        Returns:
        the exception reporting the error condition
      • makeMultipleItemsException

        public static XPathException makeMultipleItemsException​(CardinalityChecker expression,
                                                                XPathContext context)
        Construct an exception reporting that a sequence of more than item was found where a single item was expected
        Parameters:
        expression - the cardinality checker that detects the error. This is re-evaluated to include the first few items of the sequence in the error message
        context - the dynamic context
        Returns:
        the exception object that reports the error
      • makeXPathException

        public static XPathException makeXPathException​(java.lang.String message,
                                                        java.lang.String errorCode,
                                                        java.lang.String systemId,
                                                        int lineNumber,
                                                        boolean isTypeError)
        Construct (but do not throw) an XPath exception.
        Parameters:
        message - the error message
        errorCode - the local part of the error code
        systemId - the URI of the module in which the error occurs
        lineNumber - the line within the module where the error occurs
        isTypeError - true if this is a type error
        Returns:
        the XPath exception
      • stringToNumberOrNaN

        public static double stringToNumberOrNaN​(StringToDouble s2d,
                                                 java.lang.CharSequence string)
        Convert a string to a double number, returning NaN if the string is not numeric
        Parameters:
        s2d - the string to double converter to be used
        string - the string to be converted
        Returns:
        the returned number
      • doubleToIntegerOrError

        public static long doubleToIntegerOrError​(double value)
                                           throws XPathException
        Convert a double to a integer number, throwing an exception if value is equal to NaN or infinity
        Parameters:
        value - - The double type that is required to convert
        Returns:
        the returned integer number
        Throws:
        XPathException - if the supplied value is NaN or infinity
      • booleanFromString

        public static int booleanFromString​(java.lang.CharSequence s)
        Convert a string to a boolean value, using the XML Schema rules (including whitespace trimming)
        Parameters:
        s - the input string
        Returns:
        the relevant BooleanValue if validation succeeds; or a ValidationFailure if not.