New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a bundle for JSR 310 Date & Time API #33
Comments
so whats the deal with this ? is there a java 8 time bundle for gensonbuilder ? or do i need to create my own custom serializers ? |
No there isn't one, you would have to implement your own converters for these types. If you wanted to contribute them you are welcome. |
I mean lots of projects are converting from jodatime to java 8...shouldnt genson be aware of this ? i am surprised |
I have been working on Genson during my free time and for free. I have less free time now that I am willing to spend on this so this is why there is no such bundle. But again contributions are welcome. |
let me get this straight ...so is genson your baby ? are you the creator of genson ?i read something about genson scala...is that something i can use instead of genson ? would it support java 8 time ? |
Yes I'm Gensons author (and the differnet bundles and Genson Scala). No it will not. The Scala version of Genson ads support for the scala types and a few other things but doesn't come with java 8. |
okay sure thing..can i be your contributor for that ? |
Yeah sure, just to make sure you understand it, contributor here means that basically you will implement the feature and open a pull request with your changes. Or a simpler approach could be to just create your own repo on github for your java 8 bundle. In this package you can see most of the joda time specific code, I suspect the code for the java 8 bundle might look similar as the data time JSR is highly based on joda time. If you have questions on how to implement something etc you can use Genson chat room here. |
okay..thanks |
So I finally got around to implementing this here. I created a module called I took some ideas from how the Jackson library handles datetime objects and also had to make some adjustments to account for differences between JodaTime and JSR310:
TimestampsEpochThe following will be ser/deser into timestamps consisting of either epoch millis or epoch nanos (depending on configured timestamp format):
LocalDateLocalDate will be ser/deser into a timestamp containing the number of days from epoch LocalTimeLocalTime will be ser/deser into a timestamp containing the number of millis or nanos into the day (depending on configured timestamp format); Array TimestampFor the remaining types, I decided to follow the approach used by Jackson where the timestamp is an array containing the properties of the TemporalAccessor:
|
no...i am here first..you cant get integrated into actual genson..may be you can advertise your package independently |
@sooraj20890 I have no problem with that. The code is already packaged as a separate maven module so it would just be a matter of changing the groupId and package names. |
@sooraj20890 I think it might be more interesting for you to reuse what he already implemented instead of redoing all this work. Having done that in the past, it actually takes some time to get things right. If what you want is to contribute to the project there are plenty of other open issues that are not addressed yet. @nicky9door sweet, this looks really nice! If you feel like to do the extra remaining work of opening a PR and adding the finishing touches that would be great, I'll do the PR review then. That way we could publish the bundle with the rest of the code and enable others to use it. Of course you are free to publish (or not to) the bundle on your own if you don't want to make it part of Genson. A few questions:
Nice work! |
@EugenCepoi I'm cool with submitting a PR once I get the API finalized and some basic documentation written up. Hopefully it will be done within the next couple days As far as mixed modules go, I left the genson pom.xml at 1.7 and just set the genson-java-datetime module to 1.8. My intellij is configured to use a Java 8 JDK but I think the compiler respects the target property. Another option is to configure the I got the idea of using an array for the remaining types from looking at how it was implemented in the Jackson library. The idea of using an object never really crossed my mind but it's certainly possible. I might take the approach I used for the DateTimeFormatters where the timestamp format can be configured for each type |
Ok cool, that would be great, there is no rush though. On a side note, when you plan on contributing to some open source project I think it could be a good idea to open a ticket for (in the github sense) or update an existing issue, so people know that someone is working on it. Mostly to avoid the current situation where someone else also started working on the same issue. Thanks! :) |
This jsr is not provided as a maven dep. The best solution would be to provide this new bundle as a separate project in order to support older java versions.
The text was updated successfully, but these errors were encountered: