Comments (3)
(changed to an Enhancement request)
The default conversion from Date to Calendar and back again is not built-in;
but as shown from the attached test case, it can easily be implemented by
registering a BidirectionalConverter<Date, Calendar> on the mapper factory.
This does bring up a good point though -- there are some (maybe many) default
conversions that you might just expect to take place (like this example); we
can look at the possibility of adding default converters for these cases,
depending on how it affects performance and also the ability to override...
Original comment by [email protected]
on 9 May 2012 at 2:21
- Changed state: Accepted
- Added labels: Priority-Low, Type-Enhancement
- Removed labels: Priority-Medium, Type-Defect
Attachments:
from orika.
[deleted comment]
from orika.
As a part of the 1.2.0 branch, you can now automatically register an additional
set of builtin converters (which includes the ability to handle this case), by
applying a setting to the DefaultMapperFactory.Builder.
Like so:
MapperFactory factory = new DefaultMapperFactory.Builder()
.usedBuiltinConverters(true)
.build();
It can also be done by explicitly registering the builtin
DateAndTimeConverters.DateToCalendarConverter which can handle this type, like
so:
MapperFactory factory = new DefaultMapperFactory.Builder().build();
factory.getConverterFactory().registerConverter(new DateAndTimeConverters.DateToCalendarConverter());
Original comment by [email protected]
on 9 Jul 2012 at 5:36
from orika.
Related Issues (20)
- Orika should use version ranges for dependencies
- Mapping a null byte[] to a null-nested byte[] causes a NullPointerException HOT 1
- Getting NullPointer exception when converting an integer to an enum with a registered custom converter
- java.lang.ClassNotFoundException: org.eclipse.core.resources.IWorkspaceRoot HOT 1
- Usage of paranamer leads to different mapping results on developement and production environments
- Orika creates a new instance of nested list instead of using existing instance HOT 2
- BidirectionalConverter For Update Functionality HOT 1
- Orika converting entity class to HashMap when fetch entity fetched from DB. HOT 1
- java.lang.NoSuchMethodError: ch.qos.logback.classic.util.ContextInitializer.<init>(Lch/qos/logback/classic/LoggerContext;)V HOT 1
- Mapping List<String> to List<Enum> fails HOT 3
- Filter is not applied on source list. HOT 1
- SecurityException accessing Classloader with jdk8u40 HOT 2
- RuntimeException raised when source object contains a list of arrays , even if not mapped HOT 2
- Filter dest value + nested properties = NPE
- Indirect inheritance with parameter reducing leads to java.lang.ArrayIndexOutOfBoundsException HOT 2
- Request to add more debug/trace logging HOT 1
- Bypass mapping for empty string value and Trim the source string value during source to destination filed mapping HOT 4
- Constructor discovery doesn't work
- mapping error for String array HOT 1
- User Guide code to map from List to Map throws ClassCastException HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from orika.