Package com.saxonica.ee.bytecode.util

## Class Callback

- java.lang.Object
- - com.saxonica.ee.bytecode.util.Callback

-     public class Callback
      extends java.lang.Object

  A convenient place to put static methods that will be called from generated byte code

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Callback()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static int` | `booleanFromString​(java.lang.CharSequence s)` | Convert a string to a boolean value, using the XML Schema rules (including whitespace trimming)
    `static long` | `doubleToIntegerOrError​(double value)` | Convert a double to a integer number, throwing an exception if value is equal to NaN or infinity
    `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
    `static java.lang.String` | `makeMessageFromTemplate​(java.lang.String messageTemplate, java.lang.Object param0)` | Expand a message template containing one variable string
    `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
    `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
    `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
    `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.
    `static double` | `stringToNumberOrNaN​(StringToDouble s2d, java.lang.CharSequence string)` | Convert a string to a double number, returning NaN if the string is not numeric
    `static StructuredQName` | `structuredQNameFromEQName​(java.lang.CharSequence eqName)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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.

    - #### structuredQNameFromEQName

          public static StructuredQName structuredQNameFromEQName​(java.lang.CharSequence eqName)
                                                           throws XPathException

      Throws:
        `XPathException`