org.codehaus.jackson.map.SerializationConfig.Feature Java Examples
The following examples show how to use
org.codehaus.jackson.map.SerializationConfig.Feature.
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: ExtensionSerDeserUtils.java From occurrence with Apache License 2.0 | 6 votes |
@Override public void serialize(List<Map<Term, String>> value, JsonGenerator jgen, SerializerProvider provider) throws IOException { if ((value == null || value.isEmpty()) && provider.getConfig().isEnabled(Feature.WRITE_EMPTY_JSON_ARRAYS)) { jgen.writeStartArray(); jgen.writeEndArray(); } else { jgen.writeStartArray(); for (Map<Term, String> extension : value) { jgen.writeStartObject(); for (Entry<Term, String> entry : extension.entrySet()) { jgen.writeStringField(entry.getKey().qualifiedName(), entry.getValue()); } jgen.writeEndObject(); } jgen.writeEndArray(); } }
Example #2
Source File: ObjectMapperProvider.java From hraven with Apache License 2.0 | 5 votes |
public static ObjectMapper createCustomMapper() { ObjectMapper result = new ObjectMapper(); result.configure(Feature.INDENT_OUTPUT, true); SimpleModule module = createhRavenModule(); addJobMappings(module); module.addSerializer(Flow.class, new FlowSerializer()); module.addSerializer(AppSummary.class, new AppSummarySerializer()); module.addSerializer(TaskDetails.class, new TaskDetailsSerializer()); module.addSerializer(JobDetails.class, new JobDetailsSerializer()); result.registerModule(module); return result; }