Java Code Examples for com.fasterxml.jackson.core.JsonGenerator#canOmitFields()
The following examples show how to use
com.fasterxml.jackson.core.JsonGenerator#canOmitFields() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RntbdToken.java From azure-cosmosdb-java with MIT License | 6 votes |
@Override public void serializeAsField( final Object object, final JsonGenerator generator, final SerializerProvider provider, final PropertyWriter writer) throws Exception { if (generator.canOmitFields()) { final Object value = writer.getMember().getValue(object); if (value instanceof RntbdToken && !((RntbdToken) value).isPresent()) { return; } } writer.serializeAsField(object, generator, provider); }
Example 2
Source File: MapProperty.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void serializeAsOmittedField(Object map, JsonGenerator gen, SerializerProvider provider) throws Exception { if (!gen.canOmitFields()) { gen.writeOmittedField(getName()); } }
Example 3
Source File: BeanPropertyWriter.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Method called to indicate that serialization of a field was omitted due * to filtering, in cases where backend data format does not allow basic * omission. * * @since 2.3 */ @Override public void serializeAsOmittedField(Object bean, JsonGenerator gen, SerializerProvider prov) throws Exception { if (!gen.canOmitFields()) { gen.writeOmittedField(_name.getValue()); } }
Example 4
Source File: SimpleBeanPropertyFilter.java From lams with GNU General Public License v2.0 | 5 votes |
@Deprecated @Override public void serializeAsField(Object bean, JsonGenerator jgen, SerializerProvider provider, BeanPropertyWriter writer) throws Exception { if (include(writer)) { writer.serializeAsField(bean, jgen, provider); } else if (!jgen.canOmitFields()) { // since 2.3 writer.serializeAsOmittedField(bean, jgen, provider); } }
Example 5
Source File: SimpleBeanPropertyFilter.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void serializeAsField(Object pojo, JsonGenerator jgen, SerializerProvider provider, PropertyWriter writer) throws Exception { if (include(writer)) { writer.serializeAsField(pojo, jgen, provider); } else if (!jgen.canOmitFields()) { // since 2.3 writer.serializeAsOmittedField(pojo, jgen, provider); } }