protected PropertyBuilder constructPropertyBuilder(SerializationConfig config, BasicBeanDescription beanDesc) { return new PropertyBuilder(config, beanDesc); }
protected Object getDefaultValue(String name, Method m, Field f) { Object defaultBean = getDefaultBean(); try { if (m != null) { return m.invoke(defaultBean); } return f.get(defaultBean); } catch (Exception e) { return _throwWrapped(e, name, defaultBean); } }
JavaType serializationType = findSerializationType(am, defaultUseStaticTyping, declaredType); switch (methodProps) { case NON_DEFAULT: valueToSuppress = getDefaultValue(name, m, f); if (valueToSuppress == null) { suppressNulls = true; valueToSuppress = getEmptyValueChecker(name, declaredType); break; case NON_NULL: valueToSuppress = getContainerValueChecker(name, declaredType);
BeanProperty.Std property = new BeanProperty.Std(name, type, pb.getClassAnnotations(), accessor); BeanPropertyWriter pbw = pb.buildWriter(name, type, annotatedSerializer, typeSer, contentTypeSer, accessor, staticTyping);
protected BeanPropertyWriter _buildProperty(String name, JsonSerializer<Object> ser, boolean defaultUseStaticTyping, Annotated a, Method m, Field f) { Class<?> serializationType = findSerializationType(a, defaultUseStaticTyping); Object suppValue = null; boolean suppressNulls = false; JsonSerialize.Inclusion methodProps = _annotationIntrospector.findSerializationInclusion(a, _outputProps); if (methodProps != null) { switch (methodProps) { case NON_DEFAULT: suppValue = getDefaultValue(name, m, f); if (suppValue == null) { suppressNulls = true; } break; case NON_NULL: suppressNulls = true; break; } } return new BeanPropertyWriter(name, ser, serializationType, m, f, suppressNulls, suppValue); }
BeanProperty.Std property = new BeanProperty.Std(name, type, pb.getClassAnnotations(), accessor); BeanPropertyWriter pbw = pb.buildWriter(name, type, annotatedSerializer, typeSer, contentTypeSer, accessor, staticTyping);
JavaType serializationType = findSerializationType(am, defaultUseStaticTyping, declaredType); switch (methodProps) { case NON_DEFAULT: suppValue = getDefaultValue(name, m, f); if (suppValue == null) { suppressNulls = true;
JavaType serializationType = findSerializationType(am, defaultUseStaticTyping, declaredType); switch (methodProps) { case NON_DEFAULT: valueToSuppress = getDefaultValue(name, m, f); if (valueToSuppress == null) { suppressNulls = true; valueToSuppress = getEmptyValueChecker(name, declaredType); break; case NON_NULL: valueToSuppress = getContainerValueChecker(name, declaredType);
protected Object getDefaultValue(String name, Method m, Field f) { Object defaultBean = getDefaultBean(); try { if (m != null) { return m.invoke(defaultBean); } return f.get(defaultBean); } catch (Exception e) { return _throwWrapped(e, name, defaultBean); } }
BeanProperty.Std property = new BeanProperty.Std(name, type, pb.getClassAnnotations(), accessor); BeanPropertyWriter pbw = pb.buildWriter(name, type, annotatedSerializer, typeSer, contentTypeSer, accessor, staticTyping);
protected PropertyBuilder constructPropertyBuilder(SerializationConfig config, BasicBeanDescription beanDesc) { return new PropertyBuilder(config, beanDesc); }
JavaType serializationType = findSerializationType(am, defaultUseStaticTyping, declaredType); switch (methodProps) { case NON_DEFAULT: valueToSuppress = getDefaultValue(name, m, f); if (valueToSuppress == null) { suppressNulls = true; valueToSuppress = getEmptyValueChecker(name, declaredType); break; case NON_NULL: valueToSuppress = getContainerValueChecker(name, declaredType);
protected Object getDefaultValue(String name, Method m, Field f) { Object defaultBean = getDefaultBean(); try { if (m != null) { return m.invoke(defaultBean); } return f.get(defaultBean); } catch (Exception e) { return _throwWrapped(e, name, defaultBean); } }
/** * Secondary helper method for constructing {@link BeanPropertyWriter} for * given member (field or method). */ protected BeanPropertyWriter _constructWriter(SerializationConfig config, TypeBindings typeContext, PropertyBuilder pb, boolean staticTyping, String name, AnnotatedMember accessor) throws JsonMappingException { if (config.isEnabled(SerializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS)) { accessor.fixAccess(); } JavaType type = accessor.getType(typeContext); BeanProperty.Std property = new BeanProperty.Std(name, type, pb.getClassAnnotations(), accessor); // Does member specify a serializer? If so, let's use it. JsonSerializer<Object> annotatedSerializer = findSerializerFromAnnotation(config, accessor, property); // And how about polymorphic typing? First special to cover JAXB per-field settings: TypeSerializer contentTypeSer = null; if (ClassUtil.isCollectionMapOrArray(type.getRawClass())) { contentTypeSer = findPropertyContentTypeSerializer(type, config, accessor, property); } // and if not JAXB collection/array with annotations, maybe regular type info? TypeSerializer typeSer = findPropertyTypeSerializer(type, config, accessor, property); BeanPropertyWriter pbw = pb.buildWriter(name, type, annotatedSerializer, typeSer, contentTypeSer, accessor, staticTyping); // how about views? (1.4+) AnnotationIntrospector intr = config.getAnnotationIntrospector(); pbw.setViews(intr.findSerializationViews(accessor)); return pbw; }
protected PropertyBuilder constructPropertyBuilder(SerializationConfig config, BasicBeanDescription beanDesc) { return new PropertyBuilder(config, beanDesc); }
JavaType serializationType = findSerializationType(am, defaultUseStaticTyping, declaredType); switch (methodProps) { case NON_DEFAULT: valueToSuppress = getDefaultValue(name, m, f); if (valueToSuppress == null) { suppressNulls = true; valueToSuppress = getEmptyValueChecker(name, declaredType); break; case NON_NULL: valueToSuppress = getContainerValueChecker(name, declaredType);
protected Object getDefaultValue(String name, Method m, Field f) { Object defaultBean = getDefaultBean(); try { if (m != null) { return m.invoke(defaultBean); } return f.get(defaultBean); } catch (Exception e) { return _throwWrapped(e, name, defaultBean); } }
BeanProperty.Std property = new BeanProperty.Std(name, type, pb.getClassAnnotations(), accessor); BeanPropertyWriter pbw = pb.buildWriter(name, type, annotatedSerializer, typeSer, contentTypeSer, accessor, staticTyping);
protected PropertyBuilder constructPropertyBuilder(SerializationConfig config, BasicBeanDescription beanDesc) { return new PropertyBuilder(config, beanDesc); }
protected Object getDefaultValue(String name, Method m, Field f) { Object defaultBean = getDefaultBean(); try { if (m != null) { return m.invoke(defaultBean); } return f.get(defaultBean); } catch (Exception e) { return _throwWrapped(e, name, defaultBean); } }