Java Code Examples for com.fasterxml.jackson.databind.jsontype.TypeDeserializer#deserializeTypedFromObject()

The following examples show how to use com.fasterxml.jackson.databind.jsontype.TypeDeserializer#deserializeTypedFromObject() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MapDeserializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Object deserializeWithType(JsonParser p, DeserializationContext ctxt,
        TypeDeserializer typeDeserializer)
    throws IOException
{
    // In future could check current token... for now this should be enough:
    return typeDeserializer.deserializeTypedFromObject(p, ctxt);
}
 
Example 2
Source File: EnumMapDeserializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Object deserializeWithType(JsonParser p, DeserializationContext ctxt,
        TypeDeserializer typeDeserializer)
    throws IOException
{
    // In future could check current token... for now this should be enough:
    return typeDeserializer.deserializeTypedFromObject(p, ctxt);
}
 
Example 3
Source File: MapEntryDeserializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Object deserializeWithType(JsonParser p, DeserializationContext ctxt,
        TypeDeserializer typeDeserializer)
    throws IOException
{
    // In future could check current token... for now this should be enough:
    return typeDeserializer.deserializeTypedFromObject(p, ctxt);
}
 
Example 4
Source File: AbstractDeserializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Object deserializeWithType(JsonParser p, DeserializationContext ctxt,
        TypeDeserializer typeDeserializer)
    throws IOException
{
    // Hmmh. One tricky question; for scalar, is it an Object Id, or "Natural" type?
    // for now, prefer Object Id:
    if (_objectIdReader != null) {
        JsonToken t = p.getCurrentToken();
        if (t != null) {
            // Most commonly, a scalar (int id, uuid String, ...)
            if (t.isScalarValue()) {
                return _deserializeFromObjectId(p, ctxt);
            }
            // but, with 2.5+, a simple Object-wrapped value also legal:
            if (t == JsonToken.START_OBJECT) {
                t = p.nextToken();
            }
            if ((t == JsonToken.FIELD_NAME) && _objectIdReader.maySerializeAsObject()
                    && _objectIdReader.isValidReferencePropertyName(p.getCurrentName(), p)) {
                return _deserializeFromObjectId(p, ctxt);
            }
        }
    }
    // First: support "natural" values (which are always serialized without type info!)
    Object result = _deserializeIfNatural(p, ctxt);
    if (result != null) {
        return result;
    }
    return typeDeserializer.deserializeTypedFromObject(p, ctxt);
}
 
Example 5
Source File: BeanDeserializerBase.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Object deserializeWithType(JsonParser p, DeserializationContext ctxt,
        TypeDeserializer typeDeserializer)
    throws IOException
{
    // 16-Feb-2012, tatu: ObjectId may be used as well... need to check that first
    if (_objectIdReader != null) {
        // 05-Aug-2013, tatu: May use native Object Id
        if (p.canReadObjectId()) {
            Object id = p.getObjectId();
            if (id != null) {
                Object ob = typeDeserializer.deserializeTypedFromObject(p, ctxt);
                return _handleTypedObjectId(p, ctxt, ob, id);
            }
        }
        // or, Object Ids Jackson explicitly sets
        JsonToken t = p.getCurrentToken();
        if (t != null) {
            // Most commonly, a scalar (int id, uuid String, ...)
            if (t.isScalarValue()) {
                return deserializeFromObjectId(p, ctxt);
            }
            // but, with 2.5+, a simple Object-wrapped value also legal:
            if (t == JsonToken.START_OBJECT) {
                t = p.nextToken();
            }
            if ((t == JsonToken.FIELD_NAME) && _objectIdReader.maySerializeAsObject()
                    && _objectIdReader.isValidReferencePropertyName(p.getCurrentName(), p)) {
                return deserializeFromObjectId(p, ctxt);
            }
        }
    }
    // In future could check current token... for now this should be enough:
    return typeDeserializer.deserializeTypedFromObject(p, ctxt);
}
 
Example 6
Source File: MapDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
@Override
public Object deserializeWithType(
        JsonParser p, DeserializationContext ctxt,
        TypeDeserializer typeDeserializer
)
        throws IOException {
    // note: call "...FromObject" because expected output structure
    // for value is JSON Object (regardless of contortions used for type id)
    return typeDeserializer.deserializeTypedFromObject(p, ctxt);
}
 
Example 7
Source File: GuavaMapDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
/**
 * Base implementation that does not assume specific type
 * inclusion mechanism. Sub-classes are expected to override
 * this method if they are to handle type information.
 */
@Override
public Object deserializeWithType(JsonParser p, DeserializationContext ctxt,
        TypeDeserializer typeDeserializer)
    throws IOException
{
    // note: call "...FromObject" because expected output structure
    // for value is JSON Object (regardless of contortions used for type id)
    return typeDeserializer.deserializeTypedFromObject(p, ctxt);
}
 
Example 8
Source File: RangeDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
@Override
public Object deserializeWithType(JsonParser p, DeserializationContext ctxt,
        TypeDeserializer typeDeserializer)
    throws IOException
{
    return typeDeserializer.deserializeTypedFromObject(p, ctxt);
}
 
Example 9
Source File: PCollectionsMapDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
/**
 * Base implementation that does not assume specific type
 * inclusion mechanism. Sub-classes are expected to override
 * this method if they are to handle type information.
 */
@Override
public Object deserializeWithType(JsonParser p, DeserializationContext ctxt,
        TypeDeserializer typeDeserializer)
    throws IOException
{
    // note: call "...FromObject" because expected output structure
    // for value is JSON Object (regardless of contortions used for type id)
    return typeDeserializer.deserializeTypedFromObject(p, ctxt);
}