cb1cf39c8e84b0bb309ea06c5d154e6a93f4dec5.svn-base 901 Bytes
package com.thinkgem.jeesite.common.utils.xml;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.xml.bind.annotation.adapters.XmlAdapter;
/**
* @ClassName: JaxbDateAdapter 
* @Description: TODO(这里用一句话描述这个类的作用) 
* @author xuyg
* @date 2016-8-26 下午9:42:39 
*
 */
public class JaxbDateTimeAdapter extends XmlAdapter<String, Date> {
    static final String STANDARM_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";
    @Override
    public Date unmarshal(String v) throws Exception {
        if (v == null) {
            return null;
        }
        DateFormat format = new SimpleDateFormat(STANDARM_DATE_FORMAT);
        return format.parse(v);
    }
    @Override
    public String marshal(Date v) throws Exception {
        DateFormat format = new SimpleDateFormat(STANDARM_DATE_FORMAT);
        return format.format(v);
    }
}