List of usage examples for com.fasterxml.jackson.databind.ser BeanPropertyWriter BeanPropertyWriter
public BeanPropertyWriter(BeanPropertyDefinition paramBeanPropertyDefinition, AnnotatedMember paramAnnotatedMember, Annotations paramAnnotations, JavaType paramJavaType1, JsonSerializer<?> paramJsonSerializer, TypeSerializer paramTypeSerializer, JavaType paramJavaType2, boolean paramBoolean, Object paramObject)
From source file:de.fraunhofer.iosb.ilt.sta.serialize.EntitySerializer.java
protected void serializeFieldTyped(Entity entity, JsonGenerator gen, SerializerProvider serializers, BeanDescription beanDescription, BeanPropertyDefinition beanPropertyDefinition, TypeSerializer typeSerializer) throws Exception { try {/*w ww . j a va 2s. c o m*/ if (typeSerializer == null) { typeSerializer = serializers.findTypeSerializer( serializers.constructType(beanPropertyDefinition.getAccessor().getRawType())); } if (typeSerializer == null) { // if not static type if available use dynamic type if available Object propertyValue = beanPropertyDefinition.getAccessor().getValue(entity); if (propertyValue != null) { typeSerializer = serializers .findTypeSerializer(serializers.constructType(propertyValue.getClass())); } } BeanPropertyWriter bpw = new BeanPropertyWriter(beanPropertyDefinition, beanPropertyDefinition.getAccessor(), beanDescription.getClassAnnotations(), beanPropertyDefinition.getAccessor().getType(), null, // will be searched automatically typeSerializer, // will not be searched automatically beanPropertyDefinition.getAccessor().getType(), suppressNulls(serializers.getConfig().getDefaultPropertyInclusion()), suppressableValue(serializers.getConfig().getDefaultPropertyInclusion())); bpw.serializeAsField(entity, gen, serializers); } catch (JsonMappingException ex) { Logger.getLogger(EntitySerializer.class.getName()).log(Level.SEVERE, null, ex); } }