javax.xml.bind.TemporalAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-xml Show documentation
Show all versions of commons-xml Show documentation
Common classes for XML schema generation and mapping
package javax.xml.bind;
import java.time.format.DateTimeFormatter;
import java.time.temporal.Temporal;
import javax.xml.bind.annotation.adapters.XmlAdapter;
public abstract class TemporalAdapter extends XmlAdapter {
DateTimeFormatter formatter;
public TemporalAdapter(DateTimeFormatter f) {
formatter = f;
}
@Override
public String marshal(T v) throws Exception {
if(v==null) return null;
else return formatter.format(v);
}
}