Package net.sf.saxon.expr
Class JPConverter
- java.lang.Object
-
- net.sf.saxon.expr.JPConverter
-
- Direct Known Subclasses:
JPConverter.ExternalObjectWrapper
,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.FromInstant
,JPConverter.FromInt
,JPConverter.FromIntArray
,JPConverter.FromLocalDate
,JPConverter.FromLocalDateTime
,JPConverter.FromLong
,JPConverter.FromLongArray
,JPConverter.FromObject
,JPConverter.FromObjectArray
,JPConverter.FromOffsetDateTime
,JPConverter.FromQName
,JPConverter.FromSequence
,JPConverter.FromSequenceIterator
,JPConverter.FromShort
,JPConverter.FromShortArray
,JPConverter.FromSource
,JPConverter.FromString
,JPConverter.FromURI
,JPConverter.FromXdmValue
,JPConverter.FromZonedDateTime
,JPConverter.VoidConverter
public abstract class JPConverter extends java.lang.Object
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.
-
-
Nested Class Summary
-
Constructor Summary
Constructors Constructor Description JPConverter()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static JPConverter
allocate(java.lang.Class javaClass, java.lang.reflect.Type genericType, Configuration config)
Allocate a Java-to-XPath converter for a given class of Java objectsabstract Sequence
convert(java.lang.Object object, XPathContext context)
Convert a Java object to an equivalent XPath valueint
getCardinality()
Get the cardinality of the XPath value that will result from the conversionabstract ItemType
getItemType()
Get the item type of the XPath value that will result from the conversion
-
-
-
Method Detail
-
allocate
public static JPConverter allocate(java.lang.Class javaClass, java.lang.reflect.Type genericType, 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)genericType
- the generic type of the Java object; may be null if unknownconfig
- the Saxon Configuration- Returns:
- a suitable converter
-
convert
public abstract Sequence 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 convertedcontext
- 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
-
-