Skip to content

Commit

Permalink
V0.2.1 upgrade Jackson to 2.9.6
Browse files Browse the repository at this point in the history
  • Loading branch information
dilbertside committed Dec 7, 2018
1 parent 6c525c5 commit b36c71c
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 109 deletions.
33 changes: 30 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![Release](https://jitpack.io/v/dilbertside/BOD.svg)](https://jitpack.io/#dilbertside/BOD)
[![Build Status](https://travis-ci.org/dilbertside/BOD.svg)](https://travis-ci.org/dilbertside/BOD)

# BOD
# Business Object Document

In order to achieve inter-operability between disparate systems, disparate companies and disparate supply chains, there must be a common horizontal message architecture that provides a common understanding for all.

Expand All @@ -11,8 +11,12 @@ Initially it is based on the XML schema definition.

This repository is a tentative to specify the BOD in a JSON like representation.

## Maven

To use it in your Maven build add:

### Repository

```xml
<repositories>
<repository>
Expand All @@ -22,12 +26,35 @@ To use it in your Maven build add:
</repositories>
```

and the dependency:
### Dependency:


```xml
<dependency>
<groupId>com.github.dilbertside</groupId>
<artifactId>BOD</artifactId>
<version>0.2.0</version>
<version>0.2.1</version>
</dependency>
```

## Gradle

To use it in your Gradle project add:

### Repository

```
repositories {
mavenLocal()
mavenCentral()
maven { url "https://jitpack.io" }
}
```

### Dependency:


```
implementation group: 'com.github.dilbertside', name: 'BOD', version: '0.2.1'
```

201 changes: 102 additions & 99 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,101 +1,104 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.dilbertside</groupId>
<artifactId>BOD</artifactId>
<version>0.2.0</version>
<packaging>jar</packaging>

<name>Business Object Document</name>
<description>In order to achieve inter-operability between disparate systems, disparate companies and disparate supply chains, there must be a common horizontal message architecture that provides a common understanding for all.</description>
<url>https://github.com/dilbertside/BOD</url>

<licenses>
<license>
<name>MIT License</name>
<url>https://opensource.org/licenses/MIT</url>
<distribution>repo</distribution>
</license>
</licenses>

<scm>
<url>https://github.com/dilbertside/BOD.git</url>
</scm>

<properties>
<java.version>1.8</java.version>
<findbugs-jsr305.version>3.0.1</findbugs-jsr305.version>
<jackson.version>2.6.6</jackson.version>
</properties>

<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>${findbugs-jsr305.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin> <!-- Create sources.jar -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.dilbertside</groupId>
<artifactId>BOD</artifactId>
<version>0.2.1</version>
<packaging>jar</packaging>
<name>Business Object Document</name>
<description>In order to achieve inter-operability between disparate systems, disparate companies and disparate supply chains, there must be a common horizontal message architecture that provides a common understanding for all.</description>
<url>https://github.com/dilbertside/BOD</url>
<licenses>
<license>
<name>MIT License</name>
<url>https://opensource.org/licenses/MIT</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>https://github.com/dilbertside/BOD.git</url>
</scm>
<properties>
<java.version>1.8</java.version>
<findbugs-jsr305.version>3.0.1</findbugs-jsr305.version>
<jackson.version>2.9.6</jackson.version>
<commons-codec.version>1.11</commons-codec.version>
<commons-lang3.version>3.8</commons-lang3.version>
</properties>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commons-codec.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>${findbugs-jsr305.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
<optional>true</optional>
</dependency>
</dependencies>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>com.github.ekryd.sortpom</groupId>
<artifactId>sortpom-maven-plugin</artifactId>
<version>2.5.0</version>
</plugin>
<plugin>
<!-- Create sources.jar -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/**
*
* CustomPayloadTypeDeserializer
*/
package com.bs.bod.converter;

import java.io.IOException;
import java.util.Collection;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.BeanProperty;
Expand All @@ -15,15 +16,16 @@
import com.fasterxml.jackson.databind.jsontype.TypeIdResolver;
import com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer;
import com.fasterxml.jackson.databind.node.TreeTraversingParser;
import com.fasterxml.jackson.databind.type.SimpleType;
import com.fasterxml.jackson.databind.type.TypeFactory;

/**
* from http://www.dilipkumarg.com/dynamic-polymorphic-type-handling-jackson/
*
* @author dbs on Dec 30, 2015 5:16:06 PM
*
* @version 1.0
* @since 0.0.3
* @version 1.0
* @version 1.1 fixed error form upgrade to 2.9.6
*
*/
public class CustomPayloadTypeDeserializer extends AsPropertyTypeDeserializer {
Expand All @@ -32,7 +34,7 @@ public class CustomPayloadTypeDeserializer extends AsPropertyTypeDeserializer {

public CustomPayloadTypeDeserializer(final JavaType bt, final TypeIdResolver idRes, final String typePropertyName, final boolean typeIdVisible,
final Class<?> defaultImpl) {
super(bt, idRes, typePropertyName, typeIdVisible, defaultImpl);
super(bt, idRes, typePropertyName, typeIdVisible, TypeFactory.defaultInstance().constructFromCanonical(defaultImpl.getCanonicalName()));
}

public CustomPayloadTypeDeserializer(final AsPropertyTypeDeserializer src, final BeanProperty property) {
Expand All @@ -48,8 +50,8 @@ public TypeDeserializer forProperty(final BeanProperty prop) {
public Object deserializeTypedFromObject(final JsonParser jp, final DeserializationContext ctxt) throws IOException {
JsonNode node = jp.readValueAsTree();
Class<?> subType = findSubType(node);
JavaType type = SimpleType.construct(subType);

JavaType type = //com.fasterxml.jackson.databind.type.SimpleType.construct(subType);
TypeFactory.defaultInstance().constructParametricType(Collection.class, subType);
JsonParser jsonParser = new TreeTraversingParser(node, jp.getCodec());
if (jsonParser.getCurrentToken() == null) {
jsonParser.nextToken();
Expand All @@ -62,7 +64,7 @@ public Object deserializeTypedFromObject(final JsonParser jp, final Deserializat
* (Map.class), losing actual type in process (getting SimpleType of Map.class which will not work as expected)
*/
if (_baseType != null && _baseType.getClass() == type.getClass()) {
type = _baseType.narrowBy(type.getRawClass());
type = _baseType.forcedNarrowBy(type.getRawClass());
}
JsonDeserializer<Object> deser = ctxt.findContextualValueDeserializer(type, _property);
return deser.deserialize(jsonParser, ctxt);
Expand Down

0 comments on commit b36c71c

Please sign in to comment.