Skip to content

Latest commit

History

44 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

ModelMapper Module for Java8

Build StatusLicenseMaven Central

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

Java 8 Date/Time

Registers the module

modelMapper.registerModule(newJsr310Module());

Configuration

We also support for configuration.

// using String patternsJsr310ModuleConfigconfig = 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(newJsr310Module(config));
// using DateTimeFormatter directlyJsr310ModuleConfigconfig = Jsr310ModuleConfig.builder()
.dateTimeFormatter(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
.dateFormatter(DateTimeFormatter.ISO_LOCAL_DATE)
.zoneId(ZoneOffset.UTC)
.build()
modelMapper.registerModule(newJsr310Module(config));

Support Mappings

Source TypeDestination Type
LocalDateTimeString
LocalDateTimeLong/long
LocalDateTimeBigDecimal
LocalDateTimeBigInteger
LocalDateTimeDate
LocalDateTimeCalendar
LocalDateString
LocalDateLong/long
LocalDateBigDecimal
LocalDateBigInteger
LocalDateDate
LocalDateCalendar
OffsetDateTimeString
OffsetDateTimeLong/long
OffsetDateTimeBigDecimal
OffsetDateTimeBigInteger
OffsetDateTimeDate
OffsetDateTimeCalendar
InstantString
InstantLong/long
InstantBigDecimal
InstantBigInteger
InstantDate
InstantCalendar
StringLocalDateTime
Long/longLocalDateTime
BigDecimalLocalDateTime
BigIntegerLocalDateTime
DateLocalDateTime
CalendarLocalDateTime
StringDateTime
Long/longDateTime
BigDecimalDateTime
BigIntegerDateTime
DateDateTime
CalendarDateTime
StringOffsetDateTime
Long/longOffsetDateTime
BigDecimalOffsetDateTime
BigIntegerOffsetDateTime
DateOffsetDateTime
CalendarOffsetDateTime
StringInstant
Long/longInstant
BigDecimalInstant
BigIntegerInstant
DateInstant
CalendarInstant

About

ModelMapper Module for Java8

Resources

Stars

13 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages