Java Code Examples for com.fasterxml.jackson.databind.ser.impl.PropertySerializerMap#SerializerAndMapResult

The following examples show how to use com.fasterxml.jackson.databind.ser.impl.PropertySerializerMap#SerializerAndMapResult . 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: HibernateProxySerializer.java    From onedev with MIT License 6 votes vote down vote up
protected JsonSerializer<Object> findSerializer(
		SerializerProvider provider, Object value) throws IOException,
		JsonProcessingException {
	/*
	 * TODO: if Hibernate did use generics, or we wanted to allow use of
	 * Jackson annotations to indicate type, should take that into user.
	 */
	Class<?> type = value.getClass();
	/*
	 * we will use a map to contain serializers found so far, keyed by type:
	 * this avoids potentially costly lookup from global caches and/or
	 * construction of new serializers
	 */
	/*
	 * 18-Oct-2013, tatu: Whether this is for the primary property or
	 * secondary is really anyone's guess at this point; proxies can exist
	 * at any level?
	 */
	PropertySerializerMap.SerializerAndMapResult result = _dynamicSerializers
			.findAndAddPrimarySerializer(type, provider, null);
	if (_dynamicSerializers != result.map) {
		_dynamicSerializers = result.map;
	}
	return result.serializer;
}
 
Example 2
Source File: StdKeySerializers.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
protected JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap map,
        Class<?> type, SerializerProvider provider) throws JsonMappingException
{
    // 27-Jun-2017, tatu: [databind#1679] Need to avoid StackOverflowError...
    if (type == Object.class) {
        // basically just need to call `toString()`, easiest way:
        JsonSerializer<Object> ser = new Default(Default.TYPE_TO_STRING, type);
        _dynamicSerializers = map.newWith(type, ser);
        return ser;
    }
    PropertySerializerMap.SerializerAndMapResult result =
            // null -> for now we won't keep ref or pass BeanProperty; could change
            map.findAndAddKeySerializer(type, provider, null);
    // did we get a new map of serializers? If so, start using it
    if (map != result.map) {
        _dynamicSerializers = result.map;
    }
    return result.serializer;
}
 
Example 3
Source File: BeanPropertyWriter.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
protected JsonSerializer<Object> _findAndAddDynamic(
        PropertySerializerMap map, Class<?> type,
        SerializerProvider provider) throws JsonMappingException {
    PropertySerializerMap.SerializerAndMapResult result;
    if (_nonTrivialBaseType != null) {
        JavaType t = provider.constructSpecializedType(_nonTrivialBaseType,
                type);
        result = map.findAndAddPrimarySerializer(t, provider, this);
    } else {
        result = map.findAndAddPrimarySerializer(type, provider, this);
    }
    // did we get a new map of serializers? If so, start using it
    if (map != result.map) {
        _dynamicSerializers = result.map;
    }
    return result.serializer;
}
 
Example 4
Source File: MapSerializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
protected final JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap map,
        Class<?> type, SerializerProvider provider) throws JsonMappingException
{
    PropertySerializerMap.SerializerAndMapResult result = map.findAndAddSecondarySerializer(type, provider, _property);
    // did we get a new map of serializers? If so, start using it
    if (map != result.map) {
        _dynamicValueSerializers = result.map;
    }
    return result.serializer;
}
 
Example 5
Source File: MapSerializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
protected final JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap map,
        JavaType type, SerializerProvider provider) throws JsonMappingException
{
    PropertySerializerMap.SerializerAndMapResult result = map.findAndAddSecondarySerializer(type, provider, _property);
    if (map != result.map) {
        _dynamicValueSerializers = result.map;
    }
    return result.serializer;
}
 
Example 6
Source File: ObjectArraySerializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
protected final JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap map,
        Class<?> type, SerializerProvider provider) throws JsonMappingException
{
    PropertySerializerMap.SerializerAndMapResult result = map.findAndAddSecondarySerializer(type, provider, _property);
    // did we get a new map of serializers? If so, start using it
    if (map != result.map) {
        _dynamicSerializers = result.map;
    }
    return result.serializer;
}
 
Example 7
Source File: ObjectArraySerializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
protected final JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap map,
        JavaType type, SerializerProvider provider) throws JsonMappingException
{
    PropertySerializerMap.SerializerAndMapResult result = map.findAndAddSecondarySerializer(type, provider, _property);
    // did we get a new map of serializers? If so, start using it
    if (map != result.map) {
        _dynamicSerializers = result.map;
    }
    return result.serializer;
}
 
Example 8
Source File: AsArraySerializerBase.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
protected final JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap map,
        Class<?> type, SerializerProvider provider) throws JsonMappingException
{
    PropertySerializerMap.SerializerAndMapResult result = map.findAndAddSecondarySerializer(type, provider, _property);
    // did we get a new map of serializers? If so, start using it
    if (map != result.map) {
        _dynamicSerializers = result.map;
    }
    return result.serializer;
}
 
Example 9
Source File: AsArraySerializerBase.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
protected final JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap map,
        JavaType type, SerializerProvider provider) throws JsonMappingException
{
    PropertySerializerMap.SerializerAndMapResult result = map.findAndAddSecondarySerializer(type, provider, _property);
    if (map != result.map) {
        _dynamicSerializers = result.map;
    }
    return result.serializer;
}
 
Example 10
Source File: SequenceWriter.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private final JsonSerializer<Object> _findAndAddDynamic(Class<?> type) throws JsonMappingException
{
    PropertySerializerMap.SerializerAndMapResult result;
    if (_typeSerializer == null) {
        result = _dynamicSerializers.findAndAddRootValueSerializer(type, _provider);
    } else {
        result = _dynamicSerializers.addSerializer(type,
                new TypeWrappedSerializer(_typeSerializer, _provider.findValueSerializer(type, null)));
    }
    _dynamicSerializers = result.map;
    return result.serializer;
}
 
Example 11
Source File: SequenceWriter.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private final JsonSerializer<Object> _findAndAddDynamic(JavaType type) throws JsonMappingException
{
    PropertySerializerMap.SerializerAndMapResult result;
    if (_typeSerializer == null) {
        result = _dynamicSerializers.findAndAddRootValueSerializer(type, _provider);
    } else {
        result = _dynamicSerializers.addSerializer(type,
                new TypeWrappedSerializer(_typeSerializer, _provider.findValueSerializer(type, null)));
    }
    _dynamicSerializers = result.map;
    return result.serializer;
}
 
Example 12
Source File: PrimitiveRefMapSerializer.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
protected final JsonSerializer<Object> _findAndAddDynamic(
        PropertySerializerMap map, JavaType type, SerializerProvider provider
) throws JsonMappingException {
    PropertySerializerMap.SerializerAndMapResult result = map.findAndAddSecondarySerializer(
            type, provider, _property);
    if (map != result.map) {
        _dynamicValueSerializers = result.map;
    }
    return result.serializer;
}