/** * Method called for primary property serializers (ones * directly created to serialize values of a POJO property), * to handle details of resolving * {@link ContextualSerializer} with given property context. * * @param property Property for which the given primary serializer is used; never null. * * @since 2.3 */ public JsonSerializer<?> handlePrimaryContextualization(JsonSerializer<?> ser, BeanProperty property) throws JsonMappingException { if (ser != null) { if (ser instanceof ContextualSerializer) { ser = ((ContextualSerializer) ser).createContextual(this, property); } } return ser; }
/** * Method called for secondary property serializers (ones * NOT directly created to serialize values of a POJO property * but instead created as a dependant serializer -- such as value serializers * for structured types, or serializers for root values) * to handle details of resolving * {@link ContextualDeserializer} with given property context. * Given that these serializers are not directly related to given property * (or, in case of root value property, to any property), annotations * accessible may or may not be relevant. * * @param property Property for which serializer is used, if any; null * when deserializing root values * * @since 2.3 */ public JsonSerializer<?> handleSecondaryContextualization(JsonSerializer<?> ser, BeanProperty property) throws JsonMappingException { if (ser != null) { if (ser instanceof ContextualSerializer) { ser = ((ContextualSerializer) ser).createContextual(this, property); } } return ser; }
valueSer = ((ContextualSerializer) valueSer).createContextual(provider, property); rowKeySer = ((ContextualSerializer) rowKeySer).createContextual(provider, property); columnKeySer = ((ContextualSerializer) columnKeySer).createContextual(provider, property);
@Override public JsonSerializer<?> createContextual(SerializerProvider prov, BeanProperty property) throws JsonMappingException { if (_endpointSerializer == null) { JavaType endpointType = _rangeType.containedTypeOrUnknown(0); // let's not consider "untyped" (java.lang.Object) to be meaningful here... if (endpointType != null && !endpointType.hasRawClass(Object.class)) { JsonSerializer<?> ser = prov.findValueSerializer(endpointType, property); return new RangeSerializer(_rangeType, ser); } /* 21-Sep-2014, tatu: Need to make sure all serializers get proper contextual * access, in case they rely on annotations on properties... (or, more generally, * in getting a chance to be contextualized) */ } else if (_endpointSerializer instanceof ContextualSerializer) { JsonSerializer<?> cs = ((ContextualSerializer)_endpointSerializer).createContextual(prov, property); if (cs != _endpointSerializer) { return new RangeSerializer(_rangeType, cs); } } return this; }
@SuppressWarnings("unchecked") protected JsonSerializer<Object> _handleContextual(JsonSerializer<?> ser, BeanProperty property) throws JsonMappingException { if (ser instanceof ContextualSerializer) { ser = ((ContextualSerializer) ser).createContextual(this, property); } return (JsonSerializer<Object>) ser; }
@SuppressWarnings("unchecked") protected JsonSerializer<Object> _handleContextual(JsonSerializer<?> ser, BeanProperty property) throws JsonMappingException { if (ser instanceof ContextualSerializer) { ser = ((ContextualSerializer) ser).createContextual(this, property); } return (JsonSerializer<Object>) ser; }
/** * Method called for primary property serializers (ones * directly created to serialize values of a POJO property), * to handle details of resolving * {@link ContextualSerializer} with given property context. * * @param property Property for which the given primary serializer is used; never null. * * @since 2.3 */ public JsonSerializer<?> handlePrimaryContextualization(JsonSerializer<?> ser, BeanProperty property) throws JsonMappingException { if (ser != null) { if (ser instanceof ContextualSerializer) { ser = ((ContextualSerializer) ser).createContextual(this, property); } } return ser; }
/** * Method called for primary property serializers (ones * directly created to serialize values of a POJO property), * to handle details of resolving * {@link ContextualSerializer} with given property context. * * @param property Property for which the given primary serializer is used; never null. * * @since 2.3 */ public JsonSerializer<?> handlePrimaryContextualization(JsonSerializer<?> ser, BeanProperty property) throws JsonMappingException { if (ser != null) { if (ser instanceof ContextualSerializer) { ser = ((ContextualSerializer) ser).createContextual(this, property); } } return ser; }
/** * Method called for primary property serializers (ones * directly created to serialize values of a POJO property), * to handle details of resolving * {@link ContextualSerializer} with given property context. * * @param property Property for which the given primary serializer is used; never null. * * @since 2.3 */ public JsonSerializer<?> handlePrimaryContextualization(JsonSerializer<?> ser, BeanProperty property) throws JsonMappingException { if (ser != null) { if (ser instanceof ContextualSerializer) { ser = ((ContextualSerializer) ser).createContextual(this, property); } } return ser; }
/** * Method called for primary property serializers (ones * directly created to serialize values of a POJO property), * to handle details of resolving * {@link ContextualSerializer} with given property context. * * @param property Property for which the given primary serializer is used; never null. * * @since 2.3 */ public JsonSerializer<?> handlePrimaryContextualization(JsonSerializer<?> ser, BeanProperty property) throws JsonMappingException { if (ser != null) { if (ser instanceof ContextualSerializer) { ser = ((ContextualSerializer) ser).createContextual(this, property); } } return ser; }
valueSer = ((ContextualSerializer) valueSer).createContextual(provider, property);
/** * Override to preserve the delegating behavior when a contextualized serializer is created. */ @Override public JsonSerializer<?> createContextual(SerializerProvider prov, BeanProperty property) throws JsonMappingException { if (_delegateSerializer instanceof ContextualSerializer) { JsonSerializer<?> contextualDelegate = ((ContextualSerializer) _delegateSerializer).createContextual(prov, property); // Check for different instance if (contextualDelegate != _delegateSerializer) { return new DelegatingMapSerializer(contextualDelegate); } } return this; } }
/** * Override to preserve the delegating behavior when a contextualized serializer is created. */ @Override public JsonSerializer<?> createContextual(SerializerProvider prov, BeanProperty property) throws JsonMappingException { if (_delegateSerializer instanceof ContextualSerializer) { JsonSerializer<?> contextualDelegate = ((ContextualSerializer) _delegateSerializer).createContextual(prov, property); // Check for different instance if (contextualDelegate != _delegateSerializer) { return new DelegatingMapSerializer(contextualDelegate); } } return this; } }
public JsonSerializer<?> createContextual(SerializerProvider provider, BeanProperty property) throws JsonMappingException { if (_valueSerializer == null) { if (_staticTyping) { return withValueSerializer(property, provider.findValueSerializer(_valueType, property)); } } else if (_valueSerializer instanceof ContextualSerializer) { return withValueSerializer(property, ((ContextualSerializer) _valueSerializer) .createContextual(provider, property)); } return this; }
public JsonSerializer<?> createContextual(SerializerProvider provider, BeanProperty property) throws JsonMappingException { TypeSerializer vts = _valueTypeSerializer; if (vts != null) { vts = vts.forProperty(property); } JsonSerializer<?> ser = _elementSerializer; if (ser == null) { if (_staticTyping) { ser = provider.findValueSerializer(_elementType, property); } } else if (ser instanceof ContextualSerializer) { ser = ((ContextualSerializer) _elementSerializer).createContextual(provider, property); } return withResolved(property, vts, ser); }
public JsonSerializer<?> createContextual(SerializerProvider provider, BeanProperty property) throws JsonMappingException { JsonSerializer<?> ser = _elementSerializer; if (ser == null) { ser = provider.findValueSerializer(String.class, property); } else if (ser instanceof ContextualSerializer) { ser = ((ContextualSerializer) ser).createContextual(provider, property); } // Optimization: default serializer just writes String, so we can avoid a call: if (isDefaultSerializer(ser)) { ser = null; } // note: will never have TypeSerializer, because Strings are "natural" type if (ser == _elementSerializer) { return this; } return new StringArraySerializer(this, property, ser); }
public JsonSerializer<?> createContextual(SerializerProvider provider, BeanProperty property) throws JsonMappingException { JsonSerializer<?> ser = _serializer; if (ser == null) { ser = provider.findValueSerializer(String.class, property); } else if (ser instanceof ContextualSerializer) { ser = ((ContextualSerializer) ser).createContextual(provider, property); } // Optimization: default serializer just writes String, so we can avoid a call: if (isDefaultSerializer(ser)) { ser = null; } // note: will never have TypeSerializer, because Strings are "natural" type if (ser == _serializer) { return this; } return new StringCollectionSerializer(ser); }
public JsonSerializer<?> createContextual(SerializerProvider provider, BeanProperty property) throws JsonMappingException { JsonSerializer<?> ser = _serializer; if (ser == null) { ser = provider.findValueSerializer(String.class, property); } else if (ser instanceof ContextualSerializer) { ser = ((ContextualSerializer) ser).createContextual(provider, property); } // Optimization: default serializer just writes String, so we can avoid a call: if (isDefaultSerializer(ser)) { ser = null; } // note: will never have TypeSerializer, because Strings are "natural" type if (ser == _serializer) { return this; } return new IndexedStringListSerializer(ser); }
public JsonSerializer<?> createContextual(SerializerProvider provider, BeanProperty property) throws JsonMappingException { TypeSerializer typeSer = _valueTypeSerializer; if (typeSer != null) { typeSer = typeSer.forProperty(property); } JsonSerializer<?> ser = _elementSerializer; if (ser == null) { if (_staticTyping && _elementType != null) { ser = provider.findValueSerializer(_elementType, property); } } else if (ser instanceof ContextualSerializer) { ser = ((ContextualSerializer) ser).createContextual(provider, property); } if ((ser != _elementSerializer) || (property != _property) || _valueTypeSerializer != typeSer) { return withResolved(property, typeSer, ser); } return this; }
@Override public JsonSerializer<?> createContextual(SerializerProvider prov, BeanProperty property) throws JsonMappingException { if (_endpointSerializer == null) { JavaType endpointType = _rangeType.containedTypeOrUnknown(0); // let's not consider "untyped" (java.lang.Object) to be meaningful here... if (endpointType != null && !endpointType.hasRawClass(Object.class)) { JsonSerializer<?> ser = prov.findValueSerializer(endpointType, property); return new RangeSerializer(_rangeType, ser); } /* 21-Sep-2014, tatu: Need to make sure all serializers get proper contextual * access, in case they rely on annotations on properties... (or, more generally, * in getting a chance to be contextualized) */ } else if (_endpointSerializer instanceof ContextualSerializer) { JsonSerializer<?> cs = ((ContextualSerializer)_endpointSerializer).createContextual(prov, property); if (cs != _endpointSerializer) { return new RangeSerializer(_rangeType, cs); } } return this; }