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.
/*
* Copyright 2013 Stanley Shyiko
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.shyiko.jackson.module.advice;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.BeanPropertyWriter;
import com.fasterxml.jackson.databind.ser.BeanSerializerBuilder;
import com.fasterxml.jackson.databind.ser.PropertyFilter;
import com.fasterxml.jackson.databind.ser.impl.BeanAsArraySerializer;
import com.fasterxml.jackson.databind.ser.impl.ObjectIdWriter;
import com.fasterxml.jackson.databind.ser.impl.WritableObjectId;
import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase;
import com.fasterxml.jackson.databind.util.NameTransformer;
import java.io.IOException;
/**
* Whole class is basically a rip-off of {@link com.fasterxml.jackson.databind.ser.BeanSerializer} with inlined
* for-{@link BeanSerializerAdvice} calls. Original code belongs to FasterXML, LLC (licensed under Apache License 2.0).
* @author Stanley Shyiko
*/
@SuppressWarnings("unchecked")
public class AdvisedBeanSerializer extends BeanSerializerBase {
private final BeanSerializerAdvice beanSerializerAdvice;
private final boolean unwrappingSerializer;
protected AdvisedBeanSerializer(JavaType type, BeanSerializerBuilder builder, BeanPropertyWriter[] properties,
BeanPropertyWriter[] filteredProperties, BeanSerializerAdvice beanSerializerAdvice) {
super(type, builder, properties, filteredProperties);
this.beanSerializerAdvice = beanSerializerAdvice;
this.unwrappingSerializer = false;
}
protected AdvisedBeanSerializer(AdvisedBeanSerializer src, String[] toIgnore) {
super(src, toIgnore);
this.beanSerializerAdvice = src.beanSerializerAdvice;
this.unwrappingSerializer = src.unwrappingSerializer;
}
protected AdvisedBeanSerializer(AdvisedBeanSerializer src, ObjectIdWriter objectIdWriter, Object filterId) {
super(src, objectIdWriter, filterId);
this.beanSerializerAdvice = src.beanSerializerAdvice;
this.unwrappingSerializer = src.unwrappingSerializer;
}
protected AdvisedBeanSerializer(AdvisedBeanSerializer src, NameTransformer nameTransformer,
boolean unwrappingSerializer) {
super(src, nameTransformer);
this.beanSerializerAdvice = src.beanSerializerAdvice;
this.unwrappingSerializer = unwrappingSerializer;
}
@Override
public JsonSerializer