Class PJConverter.ToZeroOrOne

  • Enclosing class:
    PJConverter

    public static class PJConverter.ToZeroOrOne
    extends PJConverter
    Converter for use when the target class is ZeroOrOne, which constrains the value to be a singleton or an empty sequence
    • Constructor Detail

      • ToZeroOrOne

        public ToZeroOrOne()
    • Method Detail

      • convert

        public ZeroOrOne convert​(Sequence value,
                                 java.lang.Class<?> targetClass,
                                 XPathContext context)
                          throws XPathException
        Description copied from class: PJConverter
        Convert an XPath value to a Java value of a specified class
        Specified by:
        convert in class PJConverter
        Parameters:
        value - the supplied XPath value
        targetClass - the class of the required Java value
        context - the XPath dynamic context
        Returns:
        the corresponding Java value, which is guaranteed to be an instance of the target class (except that an empty sequence is converted to null)
        Throws:
        XPathException - if the conversion is not possible or fails