jmapper-framework / jmapper-core

Elegance, high performance and robustness all in one java bean mapper
http://jmapper-framework.github.io/jmapper-core
Apache License 2.0
227 stars 41 forks source link

Custom conversions between types #77

Open reyleo opened 6 years ago

reyleo commented 6 years ago

Add feature to define custom conversion between types rather than fields

Proposal

@JMapTypeConversion(from=Long.class, to=BigDecimal.class)
BigDecimal fromLongToBigDecimal(Long longValue) {
...
}
@JMapTypeConversion(to=BigDecimal.class, from=Long.class)
Long fromBigDecimalToLong(BigDecimal decimal) {
...
}

Conversion of that type is only applied when no conversions by name are found