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

org.onetwo.common.convert.ToNiceDateConvertor Maven / Gradle / Ivy

There is a newer version: 4.7.2
Show newest version
package org.onetwo.common.convert;

import java.util.Date;

import org.onetwo.common.date.NiceDate;

public class ToNiceDateConvertor extends AbstractTypeConvert {
	
	protected ToNiceDateConvertor() {
		super(NiceDate.New(new Date(0)));
	}

	@Override
	public NiceDate doConvert(Object value, Class componentType) {
//		if(value==null)
//			return null;
		Class vtype = value.getClass();
		NiceDate date = null;
		if(Date.class.isAssignableFrom(vtype)){
			date = NiceDate.New((Date)value);
		}else{
			throw new IllegalArgumentException("only support convert Date to NiceDate");
		}
		return date;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy