Class JPConverter

    • Constructor Detail

      • JPConverter

        public JPConverter()
    • Method Detail

      • convert

        public abstract ValueRepresentation convert​(java.lang.Object object,
                                                    XPathContext context)
                                             throws XPathException
        Convert a Java object to an equivalent XPath value
        Parameters:
        object - the java object to be converted
        context - the XPath dynamic evaluation context
        Returns:
        the XPath value resulting from the conversion
        Throws:
        XPathException - if the conversion is not possible or if it fails
      • getItemType

        public abstract ItemType getItemType()
        Get the item type of the XPath value that will result from the conversion
        Returns:
        the XPath item type
      • getCardinality

        public int getCardinality()
        Get the cardinality of the XPath value that will result from the conversion
        Returns:
        the cardinality of the result
      • compile

        public java.lang.String compile​(java.lang.String var,
                                        CodeGeneratorService compiler)
        Generate a Java expression (as text) that can be used to implement this conversion when compiling a query
        Parameters:
        var - the Java variable that will hold the Java value to be converted
        compiler - provides callback services
        Returns:
        a Java expression (as text) that implements the conversion. The result of the Java expression must be of type ValueRepresentation, and if the cardinality of the converter is exactly one then it must be of type Item.