List of usage examples for com.fasterxml.jackson.core Version unknownVersion
public static Version unknownVersion()
From source file:io.druid.storage.s3.S3StorageDruidModule.java
@Override public List<? extends Module> getJacksonModules() { return ImmutableList.of(new Module() { @Override/*from ww w . j av a 2s . c o m*/ public String getModuleName() { return "DruidS3-" + System.identityHashCode(this); } @Override public Version version() { return Version.unknownVersion(); } @Override public void setupModule(SetupContext context) { context.registerSubtypes(S3LoadSpec.class); } }); }
From source file:com.cloudera.exhibit.server.main.ExhibitApplication.java
void setupMapper(ObjectMapper mapper) { SimpleModule mod = new SimpleModule("exhibit", Version.unknownVersion()); mod.addSerializer(Exhibit.class, new ExhibitSerializer()); mod.addSerializer(Frame.class, new FrameSerializer()); mapper.registerModule(mod);//from www. ja v a 2 s . c o m }
From source file:org.dawnsci.persistence.json.JacksonMarshaller.java
public JacksonMarshaller() { mapper = new ObjectMapper(); // mapping for deserializing FunctionBean SimpleModule module = new SimpleModule("ParameterMapping", Version.unknownVersion()); module.addAbstractTypeMapping(IParameter.class, Parameter.class); mapper.registerModule(module);// ww w. j a v a 2 s. c o m }
From source file:com.amazonaws.services.dynamodbv2.streamsadapter.model.RecordObjectMapper.java
public RecordObjectMapper() { super();// w w w . jav a2 s. co m SimpleModule module = new SimpleModule(MODULE, Version.unknownVersion()); // Deal with (de)serializing of byte[]. module.addSerializer(ByteBuffer.class, new ByteBufferSerializer()); module.addDeserializer(ByteBuffer.class, new ByteBufferDeserializer()); // Deal with (de)serializing of Date module.addSerializer(Date.class, DateSerializer.instance); module.addDeserializer(Date.class, new DateDeserializer()); // Don't serialize things that are null this.setSerializationInclusion(JsonInclude.Include.NON_NULL); this.addMixInAnnotations(AttributeValue.class, AttributeValueMixIn.class); this.addMixInAnnotations(Record.class, RecordMixIn.class); this.addMixInAnnotations(StreamRecord.class, StreamRecordMixIn.class); }
From source file:com.google.code.ssm.transcoders.JsonTranscoderTest.java
@Test public void testEncodeAndDecodeRegisterSerializerDirectlyToModule() { JsonObjectMapper mapper = new JsonObjectMapper(); // first add serializer then register module SimpleModule module = new SimpleModule("cemo", Version.unknownVersion()); module.addSerializer(Point.class, new PointSerializer()); mapper.registerModule(module);// w w w. ja v a2 s . c o m transcoder = new JsonTranscoder(mapper); Point p = new Point(40, 50); CachedObject co = transcoder.encode(p); assertNotNull(co); assertNotNull(co.getData()); assertEquals("{\"v\":\"40x50\"}", new String(co.getData())); }
From source file:org.nohope.jongo.JacksonProcessor.java
@Nonnull private static ObjectMapper createPreConfiguredMapper() { final ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new JodaModule()); mapper.registerModule(new ColorModule()); mapper.configure(FAIL_ON_UNKNOWN_PROPERTIES, false); mapper.configure(AUTO_DETECT_GETTERS, false); mapper.configure(AUTO_DETECT_SETTERS, false); mapper.setSerializationInclusion(NON_NULL); mapper.setVisibilityChecker(VisibilityChecker.Std.defaultInstance().withFieldVisibility(ANY)); mapper.enableDefaultTypingAsProperty(ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.Id.CLASS.getDefaultPropertyName()); final SimpleModule module = new SimpleModule("jongo", Version.unknownVersion()); module.addKeySerializer(Object.class, ComplexKeySerializer.S_OBJECT); module.addKeyDeserializer(String.class, ComplexKeyDeserializer.S_OBJECT); module.addKeyDeserializer(Object.class, ComplexKeyDeserializer.S_OBJECT); //addBSONTypeSerializers(module); mapper.registerModule(module);//w w w.jav a 2 s. c o m return mapper; }
From source file:nl.talsmasoftware.enumerables.support.json.jackson2.EnumerableModule.java
/** * Determines the version or return {@link Version#unknownVersion() unknownVersion} if this could not be determined. * * @param groupId The group ID of the maven dependency to determine the version for. * @param artifactId The artifact ID of the maven dependency to determine the version for. * @return The version of the dependency. *///w ww .j a va 2s. c o m private static Version determineVersion(String groupId, String artifactId) { Version version = Version.unknownVersion(); MavenVersion mavenVersion = MavenVersion.forDependency(groupId, artifactId); if (mavenVersion != null) { version = new Version(mavenVersion.getMajor(), mavenVersion.getMinor(), mavenVersion.getIncrement(), mavenVersion.getSuffix(), groupId, artifactId); } return version; }
From source file:com.addthis.codec.config.ConfigTraversingParser.java
@Override public Version version() { return Version.unknownVersion(); }
From source file:com.groupdocs.sdk.common.ApiInvoker.java
@SuppressWarnings("unchecked") public static Object deserialize(String json, String containerType, @SuppressWarnings("rawtypes") Class cls) throws ApiException { try {/*from w ww . j a va 2s . c om*/ ObjectMapper mapper = JsonUtil.getJsonMapper(); SimpleModule m = new SimpleModule(PACKAGE_NAME, Version.unknownVersion()); m.addDeserializer(Date.class, new CustomDateDeserializer(new DateDeserializer())); mapper.registerModule(m); if ("List".equals(containerType)) { JavaType typeInfo = mapper.getTypeFactory().constructCollectionType(List.class, cls); List<?> response = (List<?>) mapper.readValue(json, typeInfo); return response; } else if (String.class.equals(cls)) { return json; } else { return mapper.readValue(json, cls); } } catch (IOException e) { throw new ApiException(500, e.getMessage()); } }