Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package com.fasterxml.jackson.databind.ser.impl;
import java.io.IOException;
import java.util.Set;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.core.type.WritableTypeId;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import com.fasterxml.jackson.databind.ser.BeanPropertyWriter;
import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase;
import com.fasterxml.jackson.databind.util.NameTransformer;
/**
* Specialized POJO serializer that differs from
* {@link com.fasterxml.jackson.databind.ser.BeanSerializer}
* in that instead of producing a JSON Object it will output
* a JSON Array, omitting field names, and serializing values in
* specified serialization order.
* This behavior is usually triggered by using annotation
* {@link com.fasterxml.jackson.annotation.JsonFormat} or its
* equivalents.
*
* This serializer can be used for "simple" instances; and will NOT
* be used if one of following is true:
*
*
Unwrapping is used (no way to expand out array in JSON Object)
*
*
Type information ("type id") is to be used: while this could work
* for some embedding methods, it would likely cause conflicts.
*
*
Object Identity ("object id") is used: while references would work,
* the problem is inclusion of id itself.
*
*
* Note that it is theoretically possible that last 2 issues could be addressed
* (by reserving room in array, for example); and if so, support improved.
*
* In cases where array-based output is not feasible, this serializer
* can instead delegate to the original Object-based serializer; this
* is why a reference is retained to the original serializer.
*
* @since 2.1
*/
public class BeanAsArraySerializer
extends BeanSerializerBase
{
private static final long serialVersionUID = 1L; // since 2.6
/**
* Serializer that would produce JSON Object version; used in
* cases where array output cannot be used.
*/
protected final BeanSerializerBase _defaultSerializer;
/*
/**********************************************************
/* Life-cycle: constructors
/**********************************************************
*/
public BeanAsArraySerializer(BeanSerializerBase src) {
super(src, (ObjectIdWriter) null);
_defaultSerializer = src;
}
protected BeanAsArraySerializer(BeanSerializerBase src, Set toIgnore) {
super(src, toIgnore);
_defaultSerializer = src;
}
protected BeanAsArraySerializer(BeanSerializerBase src,
ObjectIdWriter oiw, Object filterId) {
super(src, oiw, filterId);
_defaultSerializer = src;
}
/*
/**********************************************************
/* Life-cycle: factory methods, fluent factories
/**********************************************************
*/
@Override
public JsonSerializer