Skip to content

Commit

Permalink
Extended readme to clarify direct dependency on Jdk8Module
Browse files Browse the repository at this point in the history
This fixes zalando#9
  • Loading branch information
Willi Schönborn committed Dec 1, 2015
1 parent 3869a43 commit b10bf7a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,14 @@ In case you're using Jackson, make sure you register the module.
```java
ObjectMapper mapper = new ObjectMapper();

mapper.registerModule(new Jdk8Module());
mapper.registerModule(new ProblemModule());
// or
mapper.findAndRegisterModules();
```

**Note**: The `ProblemModule` requires the [`Jdk8Module`](https://github.com/FasterXML/jackson-datatype-jdk8) to work.

## Creating problems

There are different ways to express problems. Ranging from limited, but easy-to-use to highly flexible and extensible,
Expand Down Expand Up @@ -220,7 +223,8 @@ If you already have an exception class that you want to extend, you should imple
public final class OutOfStockProblem extends BusinessException implements Exceptional
```

The Jackson support module will recognize this inteface and deal with the inherited properties from `Throwable` accordingly. Note: This interface only exists, because `Throwable` is a concrete class, rather than an interface.
The Jackson support module will recognize this inteface and deal with the inherited properties from `Throwable`
accordingly. Note: This interface only exists, because `Throwable` is a concrete class, rather than an interface.

## Handling problems

Expand Down
12 changes: 6 additions & 6 deletions jackson-datatype-problem/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
<version>${jackson.version}</version>
<!-- We don't work without it. Clients still need to register it though. -->
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down Expand Up @@ -98,12 +104,6 @@
<version>2.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
<version>${jackson.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<distributionManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public ProblemModule() {
* @throws IllegalArgumentException if there are duplicate status codes across all status types
*/
@SafeVarargs
public <E extends Enum & StatusType> ProblemModule(final Class<? extends E>... types) throws IllegalArgumentException {
public <E extends Enum & StatusType> ProblemModule(final Class<? extends E>... types)
throws IllegalArgumentException {
super(ProblemModule.class.getSimpleName(), getVersion());

setMixInAnnotation(Exceptional.class, ExceptionalMixin.class);
Expand All @@ -61,11 +62,13 @@ public <E extends Enum & StatusType> ProblemModule(final Class<? extends E>... t

@SuppressWarnings("deprecation")
private static Version getVersion() {
return VersionUtil.mavenVersionFor(ProblemModule.class.getClassLoader(), "org.zalando", "jackson-datatype-problem");
return VersionUtil.mavenVersionFor(ProblemModule.class.getClassLoader(),
"org.zalando", "jackson-datatype-problem");
}

@SafeVarargs
private final <E extends Enum & StatusType> ImmutableMap<Integer, StatusType> buildIndex(final Class<? extends E>... types) {
private final <E extends Enum & StatusType> ImmutableMap<Integer, StatusType> buildIndex(
final Class<? extends E>... types) {
final Builder<Integer, StatusType> builder = ImmutableMap.builder();

for (final Class<? extends E> type : types) {
Expand Down

0 comments on commit b10bf7a

Please sign in to comment.