com.zhibaocloud.carbon.intg.jackson.desensitization.CarbonDesensitizationSerializerModifier Maven / Gradle / Ivy
The newest version!
package com.zhibaocloud.carbon.intg.jackson.desensitization;
import com.fasterxml.jackson.databind.BeanDescription;
import com.fasterxml.jackson.databind.SerializationConfig;
import com.fasterxml.jackson.databind.ser.BeanPropertyWriter;
import com.fasterxml.jackson.databind.ser.BeanSerializerModifier;
import com.zhibaocloud.carbon.intg.desensitization.CarbonDesensitization;
import com.zhibaocloud.carbon.intg.desensitization.annotations.CarbonDesensitize;
import java.lang.annotation.Annotation;
import java.util.List;
/**
* @author yangtuo
*/
public class CarbonDesensitizationSerializerModifier extends BeanSerializerModifier {
@Override
@SuppressWarnings("unchecked")
public List changeProperties(SerializationConfig config,
BeanDescription beanDesc,
List beanProperties) {
for (BeanPropertyWriter beanProperty : beanProperties) {
CarbonDesensitize desensitizeAnnotation = findDesensitizeAnnotation(beanProperty);
if (desensitizeAnnotation != null) {
CarbonDesensitization