Class PJConverter

    • Constructor Detail

      • PJConverter

        public PJConverter()
    • Method Detail

      • getEquivalentSequenceType

        public static SequenceType getEquivalentSequenceType​(java.lang.Class javaClass)
        Get the nearest XPath equivalent to a Java class. A function call will be type-checked against an XPath function signature in which the Java classes are replaced by their nearest equivalent XPath types
        javaClass - a Java class
        the nearest equivalent XPath SequenceType
      • getParameterizedSequenceType

        public static SequenceType getParameterizedSequenceType​(java.lang.reflect.Type javaType)
        Get the nearest XPath equivalent to a Java parameterized type. The only parameterized types we recognize are those like Sequence<StringValue> which correspond exactly to an XPath SequenceType.
        javaType - a parameterized Java class
        the nearest equivalent XPath SequenceType
      • convert

        public abstract java.lang.Object convert​(Sequence value,
                                                 java.lang.Class<?> targetClass,
                                                 XPathContext context)
                                          throws XPathException
        Convert an XPath value to a Java value of a specified class
        value - the supplied XPath value
        targetClass - the class of the required Java value
        context - the XPath dynamic context
        the corresponding Java value, which is guaranteed to be an instance of the target class (except that an empty sequence is converted to null)
        XPathException - if the conversion is not possible or fails
      • allocate

        public static PJConverter allocate​(Configuration config,
                                           ItemType itemType,
                                           int cardinality,
                                           java.lang.Class<?> targetClass)
                                    throws XPathException
        Factory method to instantiate a converter from a given XPath type to a given Java class
        config - the Saxon Configuration
        itemType - the item type of the XPath value to be converted
        cardinality - the cardinality of the XPath value to be converted
        targetClass - the Java class required for the conversion result
        a suitable converter
        XPathException - if no conversion is possible
      • allocateNodeListCreator

        public static PJConverter allocateNodeListCreator​(Configuration config,
                                                          java.lang.Object node)
        Static method to get a converter from an XPath sequence of nodes to the representation of a NodeList in an external object model (this is really a special for DOM, which uses NodeList rather than general purpose Java collection classes)
        config - the Saxon configuration
        node - an object representing a node in an external model
        the Java object representing the external node