ModelMapper Module Java8

ModelMapper Module for Java8

License

License

Categories

Categories

Java 8 Languages ModelMapper General Purpose Libraries Bean Mapping
GroupId

GroupId

com.github.chhsiao90
ArtifactId

ArtifactId

modelmapper-module-java8
Last Version

Last Version

1.2.1
Release Date

Release Date

Type

Type

pom
Description

Description

ModelMapper Module Java8
ModelMapper Module for Java8
Project URL

Project URL

http://modelmapper.org
Source Code Management

Source Code Management

http://github.com/chhsiao90/modelmapper-module-java8/

Download modelmapper-module-java8

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.chhsiao90/modelmapper-module-java8/ -->
<dependency>
    <groupId>com.github.chhsiao90</groupId>
    <artifactId>modelmapper-module-java8</artifactId>
    <version>1.2.1</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.chhsiao90/modelmapper-module-java8/
implementation 'com.github.chhsiao90:modelmapper-module-java8:1.2.1'
// https://jarcasting.com/artifacts/com.github.chhsiao90/modelmapper-module-java8/
implementation ("com.github.chhsiao90:modelmapper-module-java8:1.2.1")
'com.github.chhsiao90:modelmapper-module-java8:pom:1.2.1'
<dependency org="com.github.chhsiao90" name="modelmapper-module-java8" rev="1.2.1">
  <artifact name="modelmapper-module-java8" type="pom" />
</dependency>
@Grapes(
@Grab(group='com.github.chhsiao90', module='modelmapper-module-java8', version='1.2.1')
)
libraryDependencies += "com.github.chhsiao90" % "modelmapper-module-java8" % "1.2.1"
[com.github.chhsiao90/modelmapper-module-java8 "1.2.1"]

Dependencies

test (1)

Group / Artifact Type Version
org.testng : testng jar 6.9.10

Project Modules

  • datetime
  • datatypes

ModelMapper Module for Java8

Build Status License Maven Central

This is a module for ModelMapper to support Java 8 features.

Java 8 Date/Time

Registers the module

modelMapper.registerModule(new Jsr310Module());

Configuration

We also support for configuration.

// using String patterns
Jsr310ModuleConfig config = Jsr310ModuleConfig.builder()
    .dateTimePattern("yyyy-MM-dd HH:mm:ss") // default is yyyy-MM-dd HH:mm:ss
    .datePattern("yyyy-MM-dd") // default is yyyy-MM-dd
    .zoneId(ZoneOffset.UTC) // default is ZoneId.systemDefault()
    .build()
modelMapper.registerModule(new Jsr310Module(config));
// using DateTimeFormatter directly
Jsr310ModuleConfig config = Jsr310ModuleConfig.builder()
    .dateTimeFormatter(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
    .dateFormatter(DateTimeFormatter.ISO_LOCAL_DATE)
    .zoneId(ZoneOffset.UTC)
    .build()
modelMapper.registerModule(new Jsr310Module(config));

Support Mappings

Source Type Destination Type
LocalDateTime String
LocalDateTime Long/long
LocalDateTime BigDecimal
LocalDateTime BigInteger
LocalDateTime Date
LocalDateTime Calendar
LocalDate String
LocalDate Long/long
LocalDate BigDecimal
LocalDate BigInteger
LocalDate Date
LocalDate Calendar
OffsetDateTime String
OffsetDateTime Long/long
OffsetDateTime BigDecimal
OffsetDateTime BigInteger
OffsetDateTime Date
OffsetDateTime Calendar
Instant String
Instant Long/long
Instant BigDecimal
Instant BigInteger
Instant Date
Instant Calendar
String LocalDateTine
Long/long LocalDateTine
BigDecimal LocalDateTine
BigInteger LocalDateTine
Date LocalDateTine
Calendar LocalDateTine
String DateTine
Long/long DateTine
BigDecimal DateTine
BigInteger DateTine
Date DateTine
Calendar DateTine
String OffsetDateTime
Long/long OffsetDateTime
BigDecimal OffsetDateTime
BigInteger OffsetDateTime
Date OffsetDateTime
Calendar OffsetDateTime
String Instant
Long/long Instant
BigDecimal Instant
BigInteger Instant
Date Instant
Calendar Instant

Versions

Version
1.2.1
1.2.0
1.1.0
1.0.0