JsonFormat.Value format = beanDesc.findExpectedFormat(null); if (format != null) { switch (format.getShape()) {
JsonFormat.Value format = beanDesc.findExpectedFormat(null); _serializationShape = (format == null) ? null : format.getShape();
/** * Constructor used by {@link BeanSerializerBuilder} to create an * instance * * @param type Nominal type of values handled by this serializer * @param builder Builder for accessing other collected information */ protected BeanSerializerBase(JavaType type, BeanSerializerBuilder builder, BeanPropertyWriter[] properties, BeanPropertyWriter[] filteredProperties) { super(type); _beanType = type; _props = properties; _filteredProps = filteredProperties; if (builder == null) { // mostly for testing _typeId = null; _anyGetterWriter = null; _propertyFilterId = null; _objectIdWriter = null; _serializationShape = null; } else { _typeId = builder.getTypeId(); _anyGetterWriter = builder.getAnyGetter(); _propertyFilterId = builder.getFilterId(); _objectIdWriter = builder.getObjectIdWriter(); JsonFormat.Value format = builder.getBeanDescription().findExpectedFormat(null); _serializationShape = (format == null) ? null : format.getShape(); } }
protected JsonSerializer<?> buildEnumSerializer(SerializationConfig config, JavaType type, BeanDescription beanDesc) throws JsonMappingException { /* As per [databind#24], may want to use alternate shape, serialize as JSON Object. * Challenge here is that EnumSerializer does not know how to produce * POJO style serialization, so we must handle that special case separately; * otherwise pass it to EnumSerializer. */ JsonFormat.Value format = beanDesc.findExpectedFormat(null); if (format != null && format.getShape() == JsonFormat.Shape.OBJECT) { // one special case: suppress serialization of "getDeclaringClass()"... ((BasicBeanDescription) beanDesc).removeProperty("declaringClass"); // returning null will mean that eventually BeanSerializer gets constructed return null; } @SuppressWarnings("unchecked") Class<Enum<?>> enumClass = (Class<Enum<?>>) type.getRawClass(); JsonSerializer<?> ser = EnumSerializer.construct(enumClass, config, beanDesc, format); // [databind#120]: Allow post-processing if (_factoryConfig.hasSerializerModifiers()) { for (BeanSerializerModifier mod : _factoryConfig.serializerModifiers()) { ser = mod.modifyEnumSerializer(config, type, beanDesc, ser); } } return ser; }
JsonFormat.Value format = beanDesc.findExpectedFormat(null); if ((format == null) || format.getShape() != JsonFormat.Shape.OBJECT) { MapLikeType mlt = (MapLikeType) type; JsonFormat.Value format = beanDesc.findExpectedFormat(null); if ((format == null) || format.getShape() != JsonFormat.Shape.OBJECT) { CollectionLikeType clt = (CollectionLikeType) type;
JsonFormat.Value formatFromAnnotation = beanDesc.findExpectedFormat(null); JsonFormat.Value format = JsonFormat.Value.merge(formatFromAnnotation, formatOverride); if (format.getShape() == JsonFormat.Shape.OBJECT) {
JsonFormat.Value format = beanDesc.findExpectedFormat(null); if ((format != null) && format.getShape() == JsonFormat.Shape.OBJECT) { return null;
JsonFormat.Value format = beanDesc.findExpectedFormat(null); if ((format != null) && format.getShape() == JsonFormat.Shape.OBJECT) { return null;
/** * @deprecated Since 2.1 use the variant that takes in <code>format</code> argument. */ @Deprecated public static EnumSerializer construct(Class<Enum<?>> enumClass, SerializationConfig config, BeanDescription beanDesc) { return construct(enumClass, config, beanDesc, beanDesc.findExpectedFormat(null)); }
/** * Constructor used by {@link BeanSerializerBuilder} to create an * instance * * @param type Nominal type of values handled by this serializer * @param builder Builder for accessing other collected information */ protected BeanSerializerBase(JavaType type, BeanSerializerBuilder builder, BeanPropertyWriter[] properties, BeanPropertyWriter[] filteredProperties) { super(type); _props = properties; _filteredProps = filteredProperties; if (builder == null) { // mostly for testing _typeId = null; _anyGetterWriter = null; _propertyFilterId = null; _objectIdWriter = null; _serializationShape = null; } else { _typeId = builder.getTypeId(); _anyGetterWriter = builder.getAnyGetter(); _propertyFilterId = builder.getFilterId(); _objectIdWriter = builder.getObjectIdWriter(); JsonFormat.Value format = builder.getBeanDescription().findExpectedFormat(null); _serializationShape = (format == null) ? null : format.getShape(); } }
/** * Constructor used by {@link BeanSerializerBuilder} to create an * instance * * @param type Nominal type of values handled by this serializer * @param builder Builder for accessing other collected information */ protected BeanSerializerBase(JavaType type, BeanSerializerBuilder builder, BeanPropertyWriter[] properties, BeanPropertyWriter[] filteredProperties) { super(type); _props = properties; _filteredProps = filteredProperties; if (builder == null) { // mostly for testing _typeId = null; _anyGetterWriter = null; _propertyFilterId = null; _objectIdWriter = null; _serializationShape = null; } else { _typeId = builder.getTypeId(); _anyGetterWriter = builder.getAnyGetter(); _propertyFilterId = builder.getFilterId(); _objectIdWriter = builder.getObjectIdWriter(); JsonFormat.Value format = builder.getBeanDescription().findExpectedFormat(null); _serializationShape = (format == null) ? null : format.getShape(); } }
JsonFormat.Value format = beanDesc.findExpectedFormat(null); _serializationShape = (format == null) ? null : format.getShape();
/** * Constructor used by {@link BeanSerializerBuilder} to create an * instance * * @param type Nominal type of values handled by this serializer * @param builder Builder for accessing other collected information */ protected BeanSerializerBase(JavaType type, BeanSerializerBuilder builder, BeanPropertyWriter[] properties, BeanPropertyWriter[] filteredProperties) { super(type); _beanType = type; _props = properties; _filteredProps = filteredProperties; if (builder == null) { // mostly for testing _typeId = null; _anyGetterWriter = null; _propertyFilterId = null; _objectIdWriter = null; _serializationShape = null; } else { _typeId = builder.getTypeId(); _anyGetterWriter = builder.getAnyGetter(); _propertyFilterId = builder.getFilterId(); _objectIdWriter = builder.getObjectIdWriter(); JsonFormat.Value format = builder.getBeanDescription().findExpectedFormat(null); _serializationShape = (format == null) ? null : format.getShape(); } }
/** * Constructor used by {@link BeanSerializerBuilder} to create an * instance * * @param type Nominal type of values handled by this serializer * @param builder Builder for accessing other collected information */ protected BeanSerializerBase(JavaType type, BeanSerializerBuilder builder, BeanPropertyWriter[] properties, BeanPropertyWriter[] filteredProperties) { super(type); _props = properties; _filteredProps = filteredProperties; if (builder == null) { // mostly for testing _typeId = null; _anyGetterWriter = null; _propertyFilterId = null; _objectIdWriter = null; _serializationShape = null; } else { _typeId = builder.getTypeId(); _anyGetterWriter = builder.getAnyGetter(); _propertyFilterId = builder.getFilterId(); _objectIdWriter = builder.getObjectIdWriter(); JsonFormat.Value format = builder.getBeanDescription().findExpectedFormat(null); _serializationShape = (format == null) ? null : format.getShape(); } }
/** * Constructor used by {@link BeanSerializerBuilder} to create an * instance * * @param type Nominal type of values handled by this serializer * @param builder Builder for accessing other collected information */ protected BeanSerializerBase(JavaType type, BeanSerializerBuilder builder, BeanPropertyWriter[] properties, BeanPropertyWriter[] filteredProperties) { super(type); _props = properties; _filteredProps = filteredProperties; if (builder == null) { // mostly for testing _typeId = null; _anyGetterWriter = null; _propertyFilterId = null; _objectIdWriter = null; _serializationShape = null; } else { _typeId = builder.getTypeId(); _anyGetterWriter = builder.getAnyGetter(); _propertyFilterId = builder.getFilterId(); _objectIdWriter = builder.getObjectIdWriter(); JsonFormat.Value format = builder.getBeanDescription().findExpectedFormat(null); _serializationShape = (format == null) ? null : format.getShape(); } }
JsonFormat.Value format = beanDesc.findExpectedFormat(null); _serializationShape = (format == null) ? null : format.getShape();
protected JsonSerializer<?> buildEnumSerializer(SerializationConfig config, JavaType type, BeanDescription beanDesc) throws JsonMappingException { /* As per [databind#24], may want to use alternate shape, serialize as JSON Object. * Challenge here is that EnumSerializer does not know how to produce * POJO style serialization, so we must handle that special case separately; * otherwise pass it to EnumSerializer. */ JsonFormat.Value format = beanDesc.findExpectedFormat(null); if (format != null && format.getShape() == JsonFormat.Shape.OBJECT) { // one special case: suppress serialization of "getDeclaringClass()"... ((BasicBeanDescription) beanDesc).removeProperty("declaringClass"); // returning null will mean that eventually BeanSerializer gets constructed return null; } @SuppressWarnings("unchecked") Class<Enum<?>> enumClass = (Class<Enum<?>>) type.getRawClass(); JsonSerializer<?> ser = EnumSerializer.construct(enumClass, config, beanDesc, format); // [databind#120]: Allow post-processing if (_factoryConfig.hasSerializerModifiers()) { for (BeanSerializerModifier mod : _factoryConfig.serializerModifiers()) { ser = mod.modifyEnumSerializer(config, type, beanDesc, ser); } } return ser; }
protected JsonSerializer<?> buildEnumSerializer(SerializationConfig config, JavaType type, BeanDescription beanDesc) throws JsonMappingException { /* As per [databind#24], may want to use alternate shape, serialize as JSON Object. * Challenge here is that EnumSerializer does not know how to produce * POJO style serialization, so we must handle that special case separately; * otherwise pass it to EnumSerializer. */ JsonFormat.Value format = beanDesc.findExpectedFormat(null); if (format != null && format.getShape() == JsonFormat.Shape.OBJECT) { // one special case: suppress serialization of "getDeclaringClass()"... ((BasicBeanDescription) beanDesc).removeProperty("declaringClass"); // returning null will mean that eventually BeanSerializer gets constructed return null; } @SuppressWarnings("unchecked") Class<Enum<?>> enumClass = (Class<Enum<?>>) type.getRawClass(); JsonSerializer<?> ser = EnumSerializer.construct(enumClass, config, beanDesc, format); // [databind#120]: Allow post-processing if (_factoryConfig.hasSerializerModifiers()) { for (BeanSerializerModifier mod : _factoryConfig.serializerModifiers()) { ser = mod.modifyEnumSerializer(config, type, beanDesc, ser); } } return ser; }
protected JsonSerializer<?> buildEnumSerializer(SerializationConfig config, JavaType type, BeanDescription beanDesc) throws JsonMappingException { /* As per [databind#24], may want to use alternate shape, serialize as JSON Object. * Challenge here is that EnumSerializer does not know how to produce * POJO style serialization, so we must handle that special case separately; * otherwise pass it to EnumSerializer. */ JsonFormat.Value format = beanDesc.findExpectedFormat(null); if (format != null && format.getShape() == JsonFormat.Shape.OBJECT) { // one special case: suppress serialization of "getDeclaringClass()"... ((BasicBeanDescription) beanDesc).removeProperty("declaringClass"); // returning null will mean that eventually BeanSerializer gets constructed return null; } @SuppressWarnings("unchecked") Class<Enum<?>> enumClass = (Class<Enum<?>>) type.getRawClass(); JsonSerializer<?> ser = EnumSerializer.construct(enumClass, config, beanDesc, format); // [Issue#120]: Allow post-processing if (_factoryConfig.hasSerializerModifiers()) { for (BeanSerializerModifier mod : _factoryConfig.serializerModifiers()) { ser = mod.modifyEnumSerializer(config, type, beanDesc, ser); } } return ser; }
protected JsonSerializer<?> buildEnumSerializer(SerializationConfig config, JavaType type, BeanDescription beanDesc) throws JsonMappingException { /* As per [databind#24], may want to use alternate shape, serialize as JSON Object. * Challenge here is that EnumSerializer does not know how to produce * POJO style serialization, so we must handle that special case separately; * otherwise pass it to EnumSerializer. */ JsonFormat.Value format = beanDesc.findExpectedFormat(null); if (format != null && format.getShape() == JsonFormat.Shape.OBJECT) { // one special case: suppress serialization of "getDeclaringClass()"... ((BasicBeanDescription) beanDesc).removeProperty("declaringClass"); // returning null will mean that eventually BeanSerializer gets constructed return null; } @SuppressWarnings("unchecked") Class<Enum<?>> enumClass = (Class<Enum<?>>) type.getRawClass(); JsonSerializer<?> ser = EnumSerializer.construct(enumClass, config, beanDesc, format); // [Issue#120]: Allow post-processing if (_factoryConfig.hasSerializerModifiers()) { for (BeanSerializerModifier mod : _factoryConfig.serializerModifiers()) { ser = mod.modifyEnumSerializer(config, type, beanDesc, ser); } } return ser; }