protected JsonSerializer<Object> _createUntypedSerializer(JavaType type, BeanProperty property) throws JsonMappingException { /* 10-Dec-2008, tatu: Is there a possibility of infinite loops * here? Shouldn't be, given that we do not pass back-reference * to this provider. But if there is, we'd need to sync calls, * and keep track of creation chain to look for loops -- fairly * easy to do, but won't add yet since it seems unnecessary. */ return (JsonSerializer<Object>)_serializerFactory.createSerializer(_config, type, property); }
public void addBeanSerializerModifier(BeanSerializerModifier modifier) { mapper._serializerFactory = mapper._serializerFactory.withSerializerModifier(modifier); }
@SuppressWarnings("unchecked") @Override public JsonSerializer<Object> findKeySerializer(JavaType keyType, BeanProperty property) throws JsonMappingException { JsonSerializer<Object> ser = _serializerFactory.createKeySerializer(_config, keyType, property); // First things first: maybe there are registered custom implementations // if not, use default one: if (ser == null) { if (_keySerializer == null) { ser = StdKeySerializers.getStdKeySerializer(keyType); } else { ser = _keySerializer; } } // 25-Feb-2011, tatu: As per [JACKSON-519], need to ensure contextuality works here, too if (ser instanceof ContextualSerializer<?>) { ContextualSerializer<?> contextual = (ContextualSerializer<?>) ser; ser = (JsonSerializer<Object>)contextual.createContextual(_config, property); } return ser; }
/** * @since 1.8 */ public final SerializerFactory withAdditionalKeySerializers(Serializers additional) { return withConfig(getConfig().withAdditionalKeySerializers(additional)); }
/** * Deprecated version of accessor for type id serializer: as of 1.7 one needs * to instead call version that passes property information through. * * @since 1.5 * * @deprecated Since 1.7, call variant with more arguments */ @Deprecated public final TypeSerializer createTypeSerializer(JavaType baseType, SerializationConfig config) { try { return createTypeSerializer(config, baseType, null); } catch (JsonMappingException e) { // not optimal but: throw new RuntimeException(e); } } }
public void addSerializers(Serializers s) { mapper._serializerFactory = mapper._serializerFactory.withAdditionalSerializers(s); }
public void addKeySerializers(Serializers s) { mapper._serializerFactory = mapper._serializerFactory.withAdditionalKeySerializers(s); }
/** * Convenience method for creating a new factory instance with additional serializer * provider; equivalent to calling *<pre> * withConfig(getConfig().withAdditionalSerializers(additional)); *<pre> * * @since 1.7 */ public final SerializerFactory withAdditionalSerializers(Serializers additional) { return withConfig(getConfig().withAdditionalSerializers(additional)); }
@Override public JsonSerializer<Object> findTypedValueSerializer(JavaType valueType, boolean cache, BeanProperty property) throws JsonMappingException { // Two-phase lookups; local non-shared cache, then shared: JsonSerializer<Object> ser = _knownSerializers.typedValueSerializer(valueType); if (ser != null) { return ser; } // If not, maybe shared map already has it? ser = _serializerCache.typedValueSerializer(valueType); if (ser != null) { return ser; } // Well, let's just compose from pieces: ser = findValueSerializer(valueType, property); TypeSerializer typeSer = _serializerFactory.createTypeSerializer(_config, valueType, property); if (typeSer != null) { ser = new WrappedSerializer(typeSer, ser); } if (cache) { _serializerCache.addTypedSerializer(valueType, ser); } return ser; }
public void addSerializers(Serializers s) { mapper._serializerFactory = mapper._serializerFactory.withAdditionalSerializers(s); }
public void addKeySerializers(Serializers s) { mapper._serializerFactory = mapper._serializerFactory.withAdditionalKeySerializers(s); }
/** * Convenience method for creating a new factory instance with additional bean * serializer modifier; equivalent to calling *<pre> * withConfig(getConfig().withSerializerModifier(modifier)); *<pre> * * @since 1.7 */ public final SerializerFactory withSerializerModifier(BeanSerializerModifier modifier) { return withConfig(getConfig().withSerializerModifier(modifier)); }
/** * Deprecated version of accessor for type id serializer: as of 1.7 one needs * to instead call version that passes property information through. * * @since 1.5 * * @deprecated Since 1.7, call variant with more arguments */ @Deprecated public final JsonSerializer<Object> createSerializer(JavaType type, SerializationConfig config) { try { return createSerializer(config, type, null); } catch (JsonMappingException e) { // not optimal but: throw new RuntimeJsonMappingException(e); } }
TypeSerializer typeSer = _serializerFactory.createTypeSerializer(_config, _config.constructType(valueType), property); if (typeSer != null) {
public void addBeanSerializerModifier(BeanSerializerModifier modifier) { mapper._serializerFactory = mapper._serializerFactory.withSerializerModifier(modifier); }
@Override public void addSerializers(Serializers s) { mapper._serializerFactory = mapper._serializerFactory.withAdditionalSerializers(s); }
@Override public void addKeySerializers(Serializers s) { mapper._serializerFactory = mapper._serializerFactory.withAdditionalKeySerializers(s); }
@SuppressWarnings("unchecked") @Override public JsonSerializer<Object> findKeySerializer(JavaType keyType, BeanProperty property) throws JsonMappingException { JsonSerializer<Object> ser = _serializerFactory.createKeySerializer(_config, keyType, property); // First things first: maybe there are registered custom implementations // if not, use default one: if (ser == null) { if (_keySerializer == null) { ser = StdKeySerializers.getStdKeySerializer(keyType); } else { ser = _keySerializer; } } // 25-Feb-2011, tatu: As per [JACKSON-519], need to ensure contextuality works here, too if (ser instanceof ContextualSerializer<?>) { ContextualSerializer<?> contextual = (ContextualSerializer<?>) ser; ser = (JsonSerializer<Object>)contextual.createContextual(_config, property); } return ser; }
/** * @since 1.8 */ public final SerializerFactory withAdditionalKeySerializers(Serializers additional) { return withConfig(getConfig().withAdditionalKeySerializers(additional)); }
protected JsonSerializer<Object> _createUntypedSerializer(JavaType type, BeanProperty property) throws JsonMappingException { /* 10-Dec-2008, tatu: Is there a possibility of infinite loops * here? Shouldn't be, given that we do not pass back-reference * to this provider. But if there is, we'd need to sync calls, * and keep track of creation chain to look for loops -- fairly * easy to do, but won't add yet since it seems unnecessary. */ return (JsonSerializer<Object>)_serializerFactory.createSerializer(_config, type, property); }