-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removing timezone from proof - TimeZone is always local norwegian time
- Loading branch information
Christian Strandenæs
committed
Mar 25, 2020
1 parent
9b19816
commit b8c762a
Showing
9 changed files
with
100 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/java/no/digipost/api/datatypes/marshalling/LocalDateTimeXmlAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package no.digipost.api.datatypes.marshalling; | ||
|
||
import javax.xml.bind.annotation.adapters.XmlAdapter; | ||
import java.time.LocalDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
public class LocalDateTimeXmlAdapter extends XmlAdapter<String, LocalDateTime> { | ||
@Override | ||
public String marshal(LocalDateTime v) { | ||
if (v == null) { | ||
return null; | ||
} | ||
return v.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME); | ||
} | ||
|
||
@Override | ||
public LocalDateTime unmarshal(final String s) { | ||
if (s == null) { | ||
return null; | ||
} | ||
return LocalDateTime.from(DateTimeFormatter.ISO_DATE_TIME.parse(s)); | ||
} | ||
|
||
} |
7 changes: 6 additions & 1 deletion
7
src/main/java/no/digipost/api/datatypes/types/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
@XmlSchema(namespace = DIGIPOST_DATATYPES_NAMESPACE, elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) | ||
@XmlAccessorType(XmlAccessType.FIELD) | ||
@XmlJavaTypeAdapter(ZonedDateTimeXmlAdapter.class) | ||
@XmlJavaTypeAdapters({ | ||
@XmlJavaTypeAdapter(ZonedDateTimeXmlAdapter.class), | ||
@XmlJavaTypeAdapter(LocalDateTimeXmlAdapter.class) | ||
}) | ||
@DataTypePackage | ||
package no.digipost.api.datatypes.types; | ||
|
||
import no.digipost.api.datatypes.documentation.DataTypePackage; | ||
import no.digipost.api.datatypes.marshalling.LocalDateTimeXmlAdapter; | ||
import no.digipost.api.datatypes.marshalling.ZonedDateTimeXmlAdapter; | ||
|
||
import javax.xml.bind.annotation.XmlAccessType; | ||
import javax.xml.bind.annotation.XmlAccessorType; | ||
import javax.xml.bind.annotation.XmlSchema; | ||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; | ||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters; | ||
|
||
import static no.digipost.api.datatypes.marshalling.DataTypesJAXBContext.DIGIPOST_DATATYPES_NAMESPACE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters