![JAR search and dependency download from the Maven repository](/logo.png)
io.github.threetenjaxb.core.ZoneIdXmlAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of threeten-jaxb-core Show documentation
Show all versions of threeten-jaxb-core Show documentation
JAXB adapters for Java 8 Date and Time API (JSR-310) types
The newest version!
package io.github.threetenjaxb.core;
import java.time.ZoneId;
import jakarta.xml.bind.annotation.adapters.XmlAdapter;
/**
* {@code XmlAdapter} mapping JSR-310 {@code ZoneId} and {@code ZoneOffset} to the time-zone ID string
*
* Time-zone ID format details:
*
* - {@link java.time.ZoneId#of(java.lang.String)}
* - {@link java.time.ZoneId#getId()}
*
*
* @see jakarta.xml.bind.annotation.adapters.XmlAdapter
* @see java.time.ZoneId
* @see java.time.ZoneOffset
*/
public class ZoneIdXmlAdapter extends XmlAdapter {
@Override
public ZoneId unmarshal(String stringValue) {
return stringValue != null ? ZoneId.of(stringValue) : null;
}
@Override
public String marshal(ZoneId value) {
return value != null ? value.getId() : null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy