Skip to content
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

Adding optional support for joda-time's DateTime class #127

Merged
merged 1 commit into from
Mar 25, 2017
Merged

Adding optional support for joda-time's DateTime class #127

merged 1 commit into from
Mar 25, 2017

Conversation

jthoenes
Copy link

  • we check, if JavaTime is available in class path
  • if it is, we handle it exactly like java.util.Date

- we check, if JavaTime is available in class path
- if it is, we handle it exactly like java.util.Date
@vojtechhabarta
Copy link
Owner

@jthoenes thanks for your PR.

I don't want to process types from external libraries in DefaultTypeProcessor. But in this case it is just one class (org.joda.time.DateTime) so lets leave it in DefaultTypeProcessor for now and it can be refactored into some new TypeProcessor later.

@vojtechhabarta vojtechhabarta merged commit fe6ce96 into vojtechhabarta:master Mar 25, 2017
@vojtechhabarta
Copy link
Owner

Part of 1.22.307 release.

@vojtechhabarta
Copy link
Owner

@jthoenes I removed support for org.joda.time.DateTime type in v1.28.343 because I want to minimize specific library handling in typescript-generator core. Sorry for that.

Instead I added support for java.time date types (similar to joda types but part of Java 8). All types that implement java.time.temporal.Temporal are now considered to be date types. Jackson2 supports these classes using com.fasterxml.jackson.datatype:jackson-datatype-jsr310 module which can be added to Jackson2 using

new ObjectMapper().registerModule(new JavaTimeModule())
// or
new ObjectMapper().findAndRegisterModules()

Joda's org.joda.time.DateTime still can be used. It can be mapped for example to string using customTypeMappings parameter. Here is Maven configuration sample:

<configuration>
    <customTypeMappings>
        <mapping>org.joda.time.DateTime:string</mapping>
    </customTypeMappings>
    ...
</configuration>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants