com.fasterxml.jackson.databind.ser.impl.PropertySerializerMap Java Examples
The following examples show how to use
com.fasterxml.jackson.databind.ser.impl.PropertySerializerMap.
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: MapSerializer.java From lams with GNU General Public License v2.0 | 6 votes |
/** * @since 2.5 */ @SuppressWarnings("unchecked") protected MapSerializer(Set<String> ignoredEntries, JavaType keyType, JavaType valueType, boolean valueTypeIsStatic, TypeSerializer vts, JsonSerializer<?> keySerializer, JsonSerializer<?> valueSerializer) { super(Map.class, false); _ignoredEntries = ((ignoredEntries == null) || ignoredEntries.isEmpty()) ? null : ignoredEntries; _keyType = keyType; _valueType = valueType; _valueTypeIsStatic = valueTypeIsStatic; _valueTypeSerializer = vts; _keySerializer = (JsonSerializer<Object>) keySerializer; _valueSerializer = (JsonSerializer<Object>) valueSerializer; _dynamicValueSerializers = PropertySerializerMap.emptyForProperties(); _property = null; _filterId = null; _sortKeys = false; _suppressableValue = null; _suppressNulls = false; }
Example #2
Source File: ObjectArraySerializer.java From lams with GNU General Public License v2.0 | 6 votes |
public void serializeTypedContents(Object[] value, JsonGenerator jgen, SerializerProvider provider) throws IOException { final int len = value.length; final TypeSerializer typeSer = _valueTypeSerializer; int i = 0; Object elem = null; try { PropertySerializerMap serializers = _dynamicSerializers; for (; i < len; ++i) { elem = value[i]; if (elem == null) { provider.defaultSerializeNull(jgen); continue; } Class<?> cc = elem.getClass(); JsonSerializer<Object> serializer = serializers.serializerFor(cc); if (serializer == null) { serializer = _findAndAddDynamic(serializers, cc, provider); } serializer.serializeWithType(elem, jgen, provider, typeSer); } } catch (Exception e) { wrapAndThrow(provider, e, elem, i); } }
Example #3
Source File: SequenceWriter.java From lams with GNU General Public License v2.0 | 6 votes |
public SequenceWriter(DefaultSerializerProvider prov, JsonGenerator gen, boolean closeGenerator, ObjectWriter.Prefetch prefetch) throws IOException { _provider = prov; _generator = gen; _closeGenerator = closeGenerator; _rootSerializer = prefetch.getValueSerializer(); _typeSerializer = prefetch.getTypeSerializer(); _config = prov.getConfig(); _cfgFlush = _config.isEnabled(SerializationFeature.FLUSH_AFTER_WRITE_VALUE); _cfgCloseCloseable = _config.isEnabled(SerializationFeature.CLOSE_CLOSEABLE); // important: need to cache "root value" serializers, to handle polymorphic // types properly _dynamicSerializers = PropertySerializerMap.emptyForRootValues(); }
Example #4
Source File: BeanPropertyWriter.java From lams with GNU General Public License v2.0 | 6 votes |
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 #5
Source File: StdKeySerializers.java From lams with GNU General Public License v2.0 | 6 votes |
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 #6
Source File: HibernateProxySerializer.java From onedev with MIT License | 6 votes |
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 #7
Source File: AsArraySerializerBase.java From lams with GNU General Public License v2.0 | 6 votes |
/** * @deprecated Since 2.6 Use variants that either take 'src', or do NOT pass * BeanProperty */ @Deprecated protected AsArraySerializerBase(Class<?> cls, JavaType et, boolean staticTyping, TypeSerializer vts, BeanProperty property, JsonSerializer<Object> elementSerializer) { // typing with generics is messy... have to resort to this: super(cls, false); _elementType = et; // static if explicitly requested, or if element type is final _staticTyping = staticTyping || (et != null && et.isFinal()); _valueTypeSerializer = vts; _property = property; _elementSerializer = elementSerializer; _dynamicSerializers = PropertySerializerMap.emptyForProperties(); _unwrapSingle = null; }
Example #8
Source File: StdKeySerializers.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void serialize(Object value, JsonGenerator g, SerializerProvider provider) throws IOException { Class<?> cls = value.getClass(); PropertySerializerMap m = _dynamicSerializers; JsonSerializer<Object> ser = m.serializerFor(cls); if (ser == null) { ser = _findAndAddDynamic(m, cls, provider); } ser.serialize(value, g, provider); }
Example #9
Source File: PrimitiveRefMapSerializer.java From jackson-datatypes-collections with Apache License 2.0 | 5 votes |
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 #10
Source File: TypelessCollectionSerializer.java From spring-boot-data-geode with Apache License 2.0 | 5 votes |
@Override protected void serializeContents(Collection<?> value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { jsonGenerator.setCurrentValue(value); PropertySerializerMap serializers = this._dynamicSerializers; TypeSerializer typeSerializer = this._valueTypeSerializer; int index = -1; try { for (Object element : CollectionUtils.nullSafeCollection(value)) { index++; if (Objects.isNull(element)) { serializerProvider.defaultSerializeNull(jsonGenerator); } else { Class<?> elementType = element.getClass(); JsonSerializer<Object> serializer = resolveSerializer(serializerProvider, elementType); if (typeSerializer != null) { serializer.serializeWithType(element, jsonGenerator, serializerProvider, typeSerializer); } else { serializer.serialize(element, jsonGenerator, serializerProvider); } } } } catch(Exception cause) { wrapAndThrow(serializerProvider, cause, value, index); } }
Example #11
Source File: SequenceWriter.java From lams with GNU General Public License v2.0 | 5 votes |
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: SequenceWriter.java From lams with GNU General Public License v2.0 | 5 votes |
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 #13
Source File: AsArraySerializerBase.java From lams with GNU General Public License v2.0 | 5 votes |
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 #14
Source File: AsArraySerializerBase.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Non-contextual, "blueprint" constructor typically called when the first * instance is created, without knowledge of property it was used via. * * @since 2.6 */ protected AsArraySerializerBase(Class<?> cls, JavaType et, boolean staticTyping, TypeSerializer vts, JsonSerializer<Object> elementSerializer) { super(cls, false); _elementType = et; // static if explicitly requested, or if element type is final _staticTyping = staticTyping || (et != null && et.isFinal()); _valueTypeSerializer = vts; _property = null; _elementSerializer = elementSerializer; _dynamicSerializers = PropertySerializerMap.emptyForProperties(); _unwrapSingle = null; }
Example #15
Source File: AsArraySerializerBase.java From lams with GNU General Public License v2.0 | 5 votes |
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 #16
Source File: ReferenceTypeSerializer.java From lams with GNU General Public License v2.0 | 5 votes |
public ReferenceTypeSerializer(ReferenceType fullType, boolean staticTyping, TypeSerializer vts, JsonSerializer<Object> ser) { super(fullType); _referredType = fullType.getReferencedType(); _property = null; _valueTypeSerializer = vts; _valueSerializer = ser; _unwrapper = null; _suppressableValue = null; _suppressNulls = false; _dynamicSerializers = PropertySerializerMap.emptyForProperties(); }
Example #17
Source File: MapSerializer.java From lams with GNU General Public License v2.0 | 5 votes |
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 #18
Source File: ObjectArraySerializer.java From lams with GNU General Public License v2.0 | 5 votes |
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 #19
Source File: MapSerializer.java From lams with GNU General Public License v2.0 | 5 votes |
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 #20
Source File: ObjectArraySerializer.java From lams with GNU General Public License v2.0 | 5 votes |
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 #21
Source File: ObjectArraySerializer.java From lams with GNU General Public License v2.0 | 5 votes |
public ObjectArraySerializer(JavaType elemType, boolean staticTyping, TypeSerializer vts, JsonSerializer<Object> elementSerializer) { super(Object[].class); _elementType = elemType; _staticTyping = staticTyping; _valueTypeSerializer = vts; _dynamicSerializers = PropertySerializerMap.emptyForProperties(); _elementSerializer = elementSerializer; }
Example #22
Source File: ObjectFieldPropertyWriter.java From jackson-modules-base with Apache License 2.0 | 4 votes |
@Override public final void serializeAsElement(Object bean, JsonGenerator gen, SerializerProvider prov) throws Exception { if (broken) { fallbackWriter.serializeAsElement(bean, gen, prov); return; } Object value; try { value = _propertyAccessor.objectField(bean, _propertyIndex); } catch (Throwable t) { _handleProblem(bean, gen, prov, t, true); return; } if (value == null) { if (_nullSerializer != null) { _nullSerializer.serialize(null, gen, prov); } else if (_suppressNulls) { serializeAsPlaceholder(bean, gen, prov); } else { prov.defaultSerializeNullValue(gen); } return; } JsonSerializer<Object> ser = _serializer; if (ser == null) { Class<?> cls = value.getClass(); PropertySerializerMap map = _dynamicSerializers; ser = map.serializerFor(cls); if (ser == null) { ser = _findAndAddDynamic(map, cls, prov); } } if (_suppressableValue != null) { if (MARKER_FOR_EMPTY == _suppressableValue) { if (ser.isEmpty(prov, value)) { serializeAsPlaceholder(bean, gen, prov); return; } } else if (_suppressableValue.equals(value)) { serializeAsPlaceholder(bean, gen, prov); return; } } if (value == bean) { // three choices: exception; handled by call; or pass-through if (_handleSelfReference(bean, gen, prov, ser)) { return; } } if (_typeSerializer == null) { ser.serialize(value, gen, prov); } else { ser.serializeWithType(value, gen, prov, _typeSerializer); } }
Example #23
Source File: ObjectFieldPropertyWriter.java From jackson-modules-base with Apache License 2.0 | 4 votes |
@Override public final void serializeAsField(Object bean, JsonGenerator gen, SerializerProvider prov) throws Exception { if (broken) { fallbackWriter.serializeAsField(bean, gen, prov); return; } Object value; try { value = _propertyAccessor.objectField(bean, _propertyIndex); } catch (Throwable t) { _handleProblem(bean, gen, prov, t, false); return; } // Null (etc) handling; copied from super-class impl if (value == null) { if (_nullSerializer != null) { gen.writeFieldName(_fastName); _nullSerializer.serialize(null, gen, prov); } else if (!_suppressNulls) { gen.writeFieldName(_fastName); prov.defaultSerializeNullValue(gen); } return; } JsonSerializer<Object> ser = _serializer; if (ser == null) { Class<?> cls = value.getClass(); PropertySerializerMap map = _dynamicSerializers; ser = map.serializerFor(cls); if (ser == null) { ser = _findAndAddDynamic(map, cls, prov); } } if (_suppressableValue != null) { if (MARKER_FOR_EMPTY == _suppressableValue) { if (ser.isEmpty(prov, value)) { return; } } else if (_suppressableValue.equals(value)) { return; } } if (value == bean) { // three choices: exception; handled by call; or pass-through if (_handleSelfReference(bean, gen, prov, ser)) { return; } } gen.writeFieldName(_fastName); if (_typeSerializer == null) { ser.serialize(value, gen, prov); } else { ser.serializeWithType(value, gen, prov, _typeSerializer); } }
Example #24
Source File: ObjectMethodPropertyWriter.java From jackson-modules-base with Apache License 2.0 | 4 votes |
@Override public final void serializeAsElement(Object bean, JsonGenerator gen, SerializerProvider prov) throws Exception { if (broken) { fallbackWriter.serializeAsElement(bean, gen, prov); return; } Object value; try { value = _propertyAccessor.objectGetter(bean, _propertyIndex); } catch (Throwable t) { _handleProblem(bean, gen, prov, t, true); return; } // Null (etc) handling; copied from super-class impl if (value == null) { if (_nullSerializer != null) { _nullSerializer.serialize(null, gen, prov); } else if (_suppressNulls) { serializeAsPlaceholder(bean, gen, prov); } else { prov.defaultSerializeNullValue(gen); } return; } JsonSerializer<Object> ser = _serializer; if (ser == null) { Class<?> cls = value.getClass(); PropertySerializerMap map = _dynamicSerializers; ser = map.serializerFor(cls); if (ser == null) { ser = _findAndAddDynamic(map, cls, prov); } } if (_suppressableValue != null) { if (MARKER_FOR_EMPTY == _suppressableValue) { if (ser.isEmpty(prov, value)) { serializeAsPlaceholder(bean, gen, prov); return; } } else if (_suppressableValue.equals(value)) { serializeAsPlaceholder(bean, gen, prov); return; } } if (value == bean) { // three choices: exception; handled by call; or pass-through if (_handleSelfReference(bean, gen, prov, ser)) { return; } } if (_typeSerializer == null) { ser.serialize(value, gen, prov); } else { ser.serializeWithType(value, gen, prov, _typeSerializer); } }
Example #25
Source File: ObjectMethodPropertyWriter.java From jackson-modules-base with Apache License 2.0 | 4 votes |
@Override public final void serializeAsField(Object bean, JsonGenerator gen, SerializerProvider prov) throws Exception { if (broken) { fallbackWriter.serializeAsField(bean, gen, prov); return; } Object value; try { value = _propertyAccessor.objectGetter(bean, _propertyIndex); } catch (Throwable t) { _handleProblem(bean, gen, prov, t, false); return; } // Null (etc) handling; copied from super-class impl if (value == null) { if (_nullSerializer != null) { gen.writeFieldName(_fastName); _nullSerializer.serialize(null, gen, prov); } else if (!_suppressNulls) { gen.writeFieldName(_fastName); prov.defaultSerializeNullValue(gen); } return; } JsonSerializer<Object> ser = _serializer; if (ser == null) { Class<?> cls = value.getClass(); PropertySerializerMap map = _dynamicSerializers; ser = map.serializerFor(cls); if (ser == null) { ser = _findAndAddDynamic(map, cls, prov); } } if (_suppressableValue != null) { if (MARKER_FOR_EMPTY == _suppressableValue) { if (ser.isEmpty(prov, value)) { return; } } else if (_suppressableValue.equals(value)) { return; } } if (value == bean) { // three choices: exception; handled by call; or pass-through if (_handleSelfReference(bean, gen, prov, ser)) { return; } } gen.writeFieldName(_fastName); if (_typeSerializer == null) { ser.serialize(value, gen, prov); } else { ser.serializeWithType(value, gen, prov, _typeSerializer); } }
Example #26
Source File: TypelessCollectionSerializer.java From spring-boot-data-geode with Apache License 2.0 | 4 votes |
private JsonSerializer<Object> resolveSerializer(SerializerProvider serializerProvider, Class<?> type) throws JsonMappingException { JsonSerializer<Object> resolvedSerializer = this._elementSerializer; if (Objects.isNull(resolvedSerializer)) { PropertySerializerMap dynamicSerializers = this._dynamicSerializers; resolvedSerializer = dynamicSerializers.serializerFor(type); if (Objects.isNull(resolvedSerializer)) { resolvedSerializer = Objects.nonNull(this._elementType) && this._elementType.hasGenericTypes() ? this._findAndAddDynamic(dynamicSerializers, constructSpecializedType(serializerProvider, this._elementType, type), serializerProvider) : this._findAndAddDynamic(dynamicSerializers, type, serializerProvider); } } return resolvedSerializer; }
Example #27
Source File: ObjectArraySerializer.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public void serializeContents(Object[] value, JsonGenerator gen, SerializerProvider provider) throws IOException { final int len = value.length; if (len == 0) { return; } if (_elementSerializer != null) { serializeContentsUsing(value, gen, provider, _elementSerializer); return; } if (_valueTypeSerializer != null) { serializeTypedContents(value, gen, provider); return; } int i = 0; Object elem = null; try { PropertySerializerMap serializers = _dynamicSerializers; for (; i < len; ++i) { elem = value[i]; if (elem == null) { provider.defaultSerializeNull(gen); continue; } Class<?> cc = elem.getClass(); JsonSerializer<Object> serializer = serializers.serializerFor(cc); if (serializer == null) { if (_elementType.hasGenericTypes()) { serializer = _findAndAddDynamic(serializers, provider.constructSpecializedType(_elementType, cc), provider); } else { serializer = _findAndAddDynamic(serializers, cc, provider); } } serializer.serialize(elem, gen, provider); } } catch (Exception e) { wrapAndThrow(provider, e, elem, i); } }
Example #28
Source File: VirtualBeanPropertyWriter.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public void serializeAsElement(Object bean, JsonGenerator gen, SerializerProvider prov) throws Exception { // NOTE: mostly copied from base class, but off-lined get() access final Object value = value(bean, gen, prov); if (value == null) { if (_nullSerializer != null) { _nullSerializer.serialize(null, gen, prov); } else { gen.writeNull(); } return; } JsonSerializer<Object> ser = _serializer; if (ser == null) { Class<?> cls = value.getClass(); PropertySerializerMap map = _dynamicSerializers; ser = map.serializerFor(cls); if (ser == null) { ser = _findAndAddDynamic(map, cls, prov); } } if (_suppressableValue != null) { if (MARKER_FOR_EMPTY == _suppressableValue) { if (ser.isEmpty(prov, value)) { serializeAsPlaceholder(bean, gen, prov); return; } } else if (_suppressableValue.equals(value)) { serializeAsPlaceholder(bean, gen, prov); return; } } if (value == bean) { if (_handleSelfReference(bean, gen, prov, ser)) { return; } } if (_typeSerializer == null) { ser.serialize(value, gen, prov); } else { ser.serializeWithType(value, gen, prov, _typeSerializer); } }
Example #29
Source File: VirtualBeanPropertyWriter.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public void serializeAsField(Object bean, JsonGenerator gen, SerializerProvider prov) throws Exception { // NOTE: mostly copied from base class, but off-lined get() access final Object value = value(bean, gen, prov); if (value == null) { if (_nullSerializer != null) { gen.writeFieldName(_name); _nullSerializer.serialize(null, gen, prov); } return; } JsonSerializer<Object> ser = _serializer; if (ser == null) { Class<?> cls = value.getClass(); PropertySerializerMap m = _dynamicSerializers; ser = m.serializerFor(cls); if (ser == null) { ser = _findAndAddDynamic(m, cls, prov); } } if (_suppressableValue != null) { if (MARKER_FOR_EMPTY == _suppressableValue) { if (ser.isEmpty(prov, value)) { return; } } else if (_suppressableValue.equals(value)) { return; } } if (value == bean) { // simple check for direct cycles // three choices: exception; handled by call; or pass-through if (_handleSelfReference(bean, gen, prov, ser)) { return; } } gen.writeFieldName(_name); if (_typeSerializer == null) { ser.serialize(value, gen, prov); } else { ser.serializeWithType(value, gen, prov, _typeSerializer); } }
Example #30
Source File: BeanPropertyWriter.java From lams with GNU General Public License v2.0 | 4 votes |
/** * Alternative to {@link #serializeAsField} that is used when a POJO is * serialized as JSON Array; the difference is that no field names are * written. * * @since 2.3 */ @Override public void serializeAsElement(Object bean, JsonGenerator gen, SerializerProvider prov) throws Exception { // inlined 'get()' final Object value = (_accessorMethod == null) ? _field.get(bean) : _accessorMethod.invoke(bean, (Object[]) null); if (value == null) { // nulls need specialized handling if (_nullSerializer != null) { _nullSerializer.serialize(null, gen, prov); } else { // can NOT suppress entries in tabular output gen.writeNull(); } return; } // otherwise find serializer to use JsonSerializer<Object> ser = _serializer; if (ser == null) { Class<?> cls = value.getClass(); PropertySerializerMap map = _dynamicSerializers; ser = map.serializerFor(cls); if (ser == null) { ser = _findAndAddDynamic(map, cls, prov); } } // and then see if we must suppress certain values (default, empty) if (_suppressableValue != null) { if (MARKER_FOR_EMPTY == _suppressableValue) { if (ser.isEmpty(prov, value)) { // can NOT suppress entries in // tabular output serializeAsPlaceholder(bean, gen, prov); return; } } else if (_suppressableValue.equals(value)) { // can NOT suppress // entries in tabular // output serializeAsPlaceholder(bean, gen, prov); return; } } // For non-nulls: simple check for direct cycles if (value == bean) { if (_handleSelfReference(bean, gen, prov, ser)) { return; } } if (_typeSerializer == null) { ser.serialize(value, gen, prov); } else { ser.serializeWithType(value, gen, prov, _typeSerializer); } }