All Downloads are FREE. Search and download functionalities are using the official Maven repository.

eu.europa.esig.dss.DateAdapter Maven / Gradle / Ivy

There is a newer version: 6.0.d4j.2
Show newest version
package eu.europa.esig.dss;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.xml.bind.annotation.adapters.XmlAdapter;

/**
 * This class is an adapter for java.util.Date in SOAP WS
 */
public class DateAdapter extends XmlAdapter {

	private static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";

	@Override
	public Date unmarshal(String v) throws Exception {
		SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
		sdf.setLenient(false);
		return sdf.parse(v);
	}

	@Override
	public String marshal(Date v) throws Exception {
		SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
		return sdf.format(v);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy