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

JAXB spec should be updated to support new JDK8 Date/Time apis #238

Open
Tomas-Kraus opened this issue Apr 1, 2014 · 7 comments
Open

JAXB spec should be updated to support new JDK8 Date/Time apis #238

Tomas-Kraus opened this issue Apr 1, 2014 · 7 comments
Assignees
Labels
Critical Priority enhancement New feature or request

Comments

@Tomas-Kraus
Copy link
Contributor

JAXB spec should be updated to support new JDK8 Date/Time apis

@Tomas-Kraus
Copy link
Contributor Author

@glassfishrobot Commented
Reported by snajper

@Tomas-Kraus
Copy link
Contributor Author

@glassfishrobot Commented
Was assigned to yaroska

@Tomas-Kraus
Copy link
Contributor Author

@glassfishrobot Commented
puce said:
There should be helper classes to make customization as simple as for java.util.Calendar:

https://jaxb.java.net/guide/Using_different_datatypes.html

https://docs.oracle.com/javase/8/docs/api/javax/xml/bind/DatatypeConverter.html

@Tomas-Kraus
Copy link
Contributor Author

@glassfishrobot Commented
This issue was imported from java.net JIRA JAXB-1009

@Tomas-Kraus
Copy link
Contributor Author

@lukasj lukasj transferred this issue from eclipse-ee4j/jaxb-ri May 19, 2022
@lukasj lukasj added enhancement New feature or request and removed ERR: Assignee labels May 19, 2022
@antoniosanct
Copy link
Contributor

antoniosanct commented Nov 13, 2023

@lukasj
The proper link mentions the use of an adapter class when it really makes use of java.util.Date instead of java.util.Calendar:

https://eclipse-ee4j.github.io/jaxb-ri/4.0.3/docs/ch03.html#customization-of-schema-compilation-using-different-datatypes

Is it necessary to modify API to include the "new" JSR-310?

package org.acme.foo;
public class ZonedDateTimeAdapter {
  public static ZonedDateTime parseDate(String s) {
    return DatatypeConverter.parseDate(s).toZonedDateTime();
  }
  public static String printDate(ZonedDateTime zdt) {
    Calendar cal = new GregorianCalendar();
    cal.setTime(java.util.Date.from(zdt.toInstant()));
    return DatatypeConverter.printDate(cal);
  }
}

In fact, DatatypeFactory doesn't extend JSR-310 API.

Regards,
Antonio.

@antoniosanct
Copy link
Contributor

@lukasj
What do you think about replacing Calendar to ZonedDateTime? Would it be in a future 4.1 release because of break backward-compatibility?

Regards,
Antonio.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Critical Priority enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants