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

com.firefly.utils.json.parser.DateParser Maven / Gradle / Ivy

There is a newer version: 5.0.2
Show newest version
package com.firefly.utils.json.parser;

import com.firefly.utils.json.JsonReader;
import com.firefly.utils.json.Parser;
import com.firefly.utils.time.SafeSimpleDateFormat;

public class DateParser implements Parser {
	
	private SafeSimpleDateFormat safeSimpleDateFormat = SafeSimpleDateFormat.defaultDateFormat;
	
	public DateParser() {}

	
	public DateParser(String datePattern) {
		this.safeSimpleDateFormat = new SafeSimpleDateFormat(datePattern);
	}

	@Override
	public Object convertTo(JsonReader reader, Class clazz) {
		return safeSimpleDateFormat.parse(reader.readString());
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy