Java tutorial
/****************************************************************************** ** This data and information is proprietary to, and a valuable trade secret ** of, Basis Technology Corp. It is given in confidence by Basis Technology ** and may only be used as permitted under the license agreement under which ** it has been distributed, and in no other way. ** ** Copyright (c) 2014 Basis Technology Corporation All rights reserved. ** ** The technical data and information provided herein are provided with ** `limited rights', and the computer software provided herein is provided ** with `restricted rights' as those terms are defined in DAR and ASPR ** 7-104.9(a). ******************************************************************************/ package com.basistech; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.Version; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.module.SimpleModule; /** * Jackson module to configure Json serialization and deserialization for the * annotated data model. */ public class AnnotatedDataModelModule extends SimpleModule { public AnnotatedDataModelModule() { //TODO: set up a filtered property file to deliver these facts. super("ModuleName", new Version(2, 0, 0, "", "com.basistech", "adm-json")); } public void setupModule(SetupContext context) { context.setMixInAnnotations(BaseAttribute.class, BaseAttributeMixin.class); context.setMixInAnnotations(Attribute.class, AttributeMixin.class); context.setMixInAnnotations(EntityMention.class, EntityMentionMixin.class); } /** * Register the Annotated Data Model Jackson module on an {@link com.fasterxml.jackson.databind.ObjectMapper}. * @param mapper the mapper. * @return the same mapper, for convenience. */ public static ObjectMapper setupObjectMapper(ObjectMapper mapper) { mapper.getSerializationConfig().withSerializationInclusion(JsonInclude.Include.NON_NULL); final AnnotatedDataModelModule module = new AnnotatedDataModelModule(); mapper.registerModule(module); return mapper; } }