Top Description Inners Fields Constructors Methods
tools.jackson.databind.ext

public Class CoreXMLDeserializers

extends Object
Class Inheritance
Imports
java.util.*, javax.xml.datatype.*, javax.xml.namespace.QName, tools.jackson.core.*, tools.jackson.databind.*, tools.jackson.databind.deser.std.FromStringDeserializer

Container deserializers that handle "core" XML types: ones included in standard JDK 1.5. Types are directly needed by JAXB, but may be unavailable on some limited platforms; hence separate out from basic deserializer factory.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
CoreXMLDeserializers.Std

Combo-deserializer that supports deserialization of somewhat optional javax.xml types QName, Duration and XMLGregorianCalendar.

Field Summary

Modifier and TypeField and Description
pack-priv static final DatatypeFactory
_dataTypeFactory

Data type factories are thread-safe after instantiation (and configuration, if any); and since instantiation (esp.

protected static final QName
protected static final int
protected static final int
protected static final int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static ValueDeserializer<?>
public static boolean
hasDeserializerFor(Class<?> valueType)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_dataTypeFactoryback to summary
pack-priv static final DatatypeFactory _dataTypeFactory

Data type factories are thread-safe after instantiation (and configuration, if any); and since instantiation (esp. implementation introspection) can be expensive we better reuse the instance.

EMPTY_QNAMEback to summary
protected static final QName EMPTY_QNAME
TYPE_DURATIONback to summary
protected static final int TYPE_DURATION
TYPE_G_CALENDARback to summary
protected static final int TYPE_G_CALENDAR
TYPE_QNAMEback to summary
protected static final int TYPE_QNAME

Constructor Detail

CoreXMLDeserializersback to summary
public CoreXMLDeserializers()

Method Detail

findBeanDeserializerback to summary
public static ValueDeserializer<?> findBeanDeserializer(DeserializationConfig config, JavaType type)
hasDeserializerForback to summary
public static boolean hasDeserializerFor(Class<?> valueType)
tools.jackson.databind.ext back to summary

public Class CoreXMLDeserializers.Std

extends FromStringDeserializer<Object>
Class Inheritance

Combo-deserializer that supports deserialization of somewhat optional javax.xml types QName, Duration and XMLGregorianCalendar. Combined into a single class to eliminate bunch of one-off implementation classes, to reduce resulting jar size (mostly).

Field Summary

Modifier and TypeField and Description
protected final int

Constructor Summary

AccessConstructor and Description
public
Std(Class<?> raw, int kind)

Method Summary

Modifier and TypeMethod and Description
protected Object
_deserialize(String value, DeserializationContext ctxt)

Implements abstract tools.jackson.databind.deser.std.FromStringDeserializer._deserialize.

Main method from trying to deserialize actual value from non-empty String.

protected Object
protected XMLGregorianCalendar
private QName
public Object
deserialize(JsonParser p, DeserializationContext ctxt)

Overrides tools.jackson.databind.deser.std.FromStringDeserializer.deserialize.

Method that can be called to ask implementation to deserialize JSON content into the value type this serializer handles.

Inherited from tools.jackson.databind.deser.std.FromStringDeserializer:
_deserializeEmbedded_deserializeFromEmptyStringDefault_deserializeFromOther_shouldTrimlogicalType

Field Detail

_kindback to summary
protected final int _kind

Constructor Detail

Stdback to summary
public Std(Class<?> raw, int kind)

Method Detail

_deserializeback to summary
protected Object _deserialize(String value, DeserializationContext ctxt) throws JacksonException

Implements abstract tools.jackson.databind.deser.std.FromStringDeserializer._deserialize.

Doc from tools.jackson.databind.deser.std.FromStringDeserializer._deserialize.

Main method from trying to deserialize actual value from non-empty String.

Annotations
@Override
_deserializeFromEmptyStringback to summary
protected Object _deserializeFromEmptyString(DeserializationContext ctxt)

Overrides tools.jackson.databind.deser.std.FromStringDeserializer._deserializeFromEmptyString.

Annotations
@Override
_gregorianFromDateback to summary
protected XMLGregorianCalendar _gregorianFromDate(DeserializationContext ctxt, Date d)
_parseQNameObjectback to summary
private QName _parseQNameObject(JsonParser p, DeserializationContext ctxt) throws JacksonException
deserializeback to summary
public Object deserialize(JsonParser p, DeserializationContext ctxt) throws JacksonException

Overrides tools.jackson.databind.deser.std.FromStringDeserializer.deserialize.

Doc from tools.jackson.databind.ValueDeserializer.deserialize.

Method that can be called to ask implementation to deserialize JSON content into the value type this serializer handles. Returned instance is to be constructed by method itself.

Pre-condition for this method is that the parser points to the first event that is part of value to deserializer (and which is never JSON 'null' literal, more on this below): for simple types it may be the only value; and for structured types the Object start marker or a FIELD_NAME.

The two possible input conditions for structured types result from polymorphism via fields. In the ordinary case, Jackson calls this method when it has encountered an OBJECT_START, and the method implementation must advance to the next token to see the first field name. If the application configures polymorphism via a field, then the object looks like the following.

      {
          "@class": "class name",
          ...
      }
  
Jackson consumes the two tokens (the @class field name and its value) in order to learn the class and select the deserializer. Thus, the stream is pointing to the FIELD_NAME for the first field after the @class. Thus, if you want your method to work correctly both with and without polymorphism, you must begin your method with:
       if (p.currentToken() == JsonToken.START_OBJECT) {
         p.nextToken();
       }
  
This results in the stream pointing to the field name, so that the two conditions align.

Post-condition is that the parser will point to the last event that is part of deserialized value (or in case deserialization fails, event that was not recognized or usable, which may be the same event as the one it pointed to upon call).

Handling null values (JsonToken.VALUE_NULL)
: Note that this method is never called for the JSON null literal to avoid every deserializer from having to handle null values. Instead, the ValueDeserializer#getNullValue(DeserializationContext) method is called to produce a null value. To influence null handling, custom deserializers should override ValueDeserializer#getNullValue(DeserializationContext) and usually also ValueDeserializer#getNullAccessPattern().

Annotations
@Override