net.sf.saxon.expr

## Class JPConverter

- java.lang.Object
- - net.sf.saxon.expr.JPConverter

- All Implemented Interfaces:
    Serializable
  Direct Known Subclasses:
    JPConverter.FromBigDecimal, JPConverter.FromBigInteger, JPConverter.FromBoolean, JPConverter.FromBooleanArray, JPConverter.FromByte, JPConverter.FromByteArray, JPConverter.FromCharacter, JPConverter.FromCharArray, JPConverter.FromCollection, JPConverter.FromDate, JPConverter.FromDouble, JPConverter.FromDoubleArray, JPConverter.FromFloat, JPConverter.FromFloatArray, JPConverter.FromInt, JPConverter.FromIntArray, JPConverter.FromLong, JPConverter.FromLongArray, JPConverter.FromMap, JPConverter.FromObjectArray, JPConverter.FromQName, JPConverter.FromSequence, JPConverter.FromSequenceIterator, JPConverter.FromShort, JPConverter.FromShortArray, JPConverter.FromSource, JPConverter.FromString, JPConverter.FromURI, JPConverter.VoidConverter, JPConverter.WrapExternalObject

      public abstract class JPConverter
      extends Object
      implements Serializable

  This class together with its embedded subclasses handles conversion from Java values to XPath values. The general principle is to allocate a specific JPConverter at compile time wherever possible. If there is insufficient type information to make this feasible, a general-purpose JPConverter is allocated, which in turn allocates a more specific converter at run-time to do the actual work.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `JPConverter.FromBigDecimal`
    `static class` | `JPConverter.FromBigInteger`
    `static class` | `JPConverter.FromBoolean`
    `static class` | `JPConverter.FromBooleanArray`
    `static class` | `JPConverter.FromByte`
    `static class` | `JPConverter.FromByteArray`
    `static class` | `JPConverter.FromCharacter`
    `static class` | `JPConverter.FromCharArray`
    `static class` | `JPConverter.FromCollection`
    `static class` | `JPConverter.FromDate`
    `static class` | `JPConverter.FromDouble`
    `static class` | `JPConverter.FromDoubleArray`
    `static class` | `JPConverter.FromFloat`
    `static class` | `JPConverter.FromFloatArray`
    `static class` | `JPConverter.FromInt`
    `static class` | `JPConverter.FromIntArray`
    `static class` | `JPConverter.FromLong`
    `static class` | `JPConverter.FromLongArray`
    `static class` | `JPConverter.FromMap`
    `static class` | `JPConverter.FromObjectArray`
    `static class` | `JPConverter.FromQName`
    `static class` | `JPConverter.FromSequence`
    `static class` | `JPConverter.FromSequenceIterator`
    `static class` | `JPConverter.FromShort`
    `static class` | `JPConverter.FromShortArray`
    `static class` | `JPConverter.FromSource`
    `static class` | `JPConverter.FromString`
    `static class` | `JPConverter.FromURI`
    `static class` | `JPConverter.VoidConverter`
    `static class` | `JPConverter.WrapExternalObject`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JPConverter()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static JPConverter` | `allocate(Class javaClass, Configuration config)` Allocate a Java-to-XPath converter for a given class of Java objects
    `abstract Sequence` | `convert(Object object, XPathContext context)` Convert a Java object to an equivalent XPath value
    `int` | `getCardinality()` Get the cardinality of the XPath value that will result from the conversion
    `abstract ItemType` | `getItemType()` Get the item type of the XPath value that will result from the conversion

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

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

- - ### Constructor Detail

    - #### JPConverter

          public JPConverter()

  - ### Method Detail

    - #### allocate

          public static JPConverter allocate(Class javaClass,
                             Configuration config)

      Allocate a Java-to-XPath converter for a given class of Java objects
      Parameters:
        `javaClass` - the class of the Java object to be converted (this may be the static type or the dynamic type, depending when the converter is allocated)
        `config` - the Saxon Configuration
      Returns:
        a suitable converter

    - #### convert

          public abstract Sequence convert(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

Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.