Added Jackson for Java 8 Date/Time types
parent
df8fc3f5ab
commit
6dfe7c0a95
|
|
@ -101,6 +101,10 @@
|
||||||
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||||
<artifactId>jackson-jaxrs-xml-provider</artifactId>
|
<artifactId>jackson-jaxrs-xml-provider</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Dependencies for log4j 2 -->
|
<!-- Dependencies for log4j 2 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
||||||
|
|
@ -266,6 +266,10 @@
|
||||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||||
<artifactId>jackson-dataformat-csv</artifactId>
|
<artifactId>jackson-dataformat-csv</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency> <!-- For Java 8 date/time types -->
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ package org.libreccm.imexport;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
@ -39,7 +40,13 @@ import javax.transaction.Transactional;
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractEntityImExporter<T extends Exportable> {
|
public abstract class AbstractEntityImExporter<T extends Exportable> {
|
||||||
|
|
||||||
private final ObjectMapper objectMapper = new ObjectMapper();
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
|
public AbstractEntityImExporter() {
|
||||||
|
objectMapper = new ObjectMapper()
|
||||||
|
.registerModule(new JavaTimeModule());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Entity class which is handled by the implementation. This
|
* Returns the Entity class which is handled by the implementation. This
|
||||||
|
|
@ -112,7 +119,7 @@ public abstract class AbstractEntityImExporter<T extends Exportable> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reloads the entity to export. Entities become detacted for several
|
* Reloads the entity to export. Entities become detacted for several
|
||||||
* reasons before they are passed to the null null {@link #exportEntity(org.libreccm.imexport.Exportable) method. The
|
* reasons before they are passed to the null null null {@link #exportEntity(org.libreccm.imexport.Exportable) method. The
|
||||||
* implementation of this should reload the passed entity.
|
* implementation of this should reload the passed entity.
|
||||||
*
|
*
|
||||||
* @param entity The entity to reload.
|
* @param entity The entity to reload.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue