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

org.onetwo.common.jackson.JsonTimeOnlySerializer Maven / Gradle / Ivy

There is a newer version: 5.2.7
Show newest version
package org.onetwo.common.jackson;

import java.io.IOException;
import java.util.Date;

import org.onetwo.common.date.DateUtil;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

public class JsonTimeOnlySerializer extends JsonSerializer{

	@Override
	public void serialize(Date value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
		String val = DateUtil.formatDateByPattern(value, DateUtil.TIME_ONLY);
		jgen.writeString(val);
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy