package com.ejie.aa21b.util;

/*
 * Decompiled with CFR 0_110.
 * 
 * Could not load the following classes:
 *  com.ejie.x38.util.DateTimeManager
 *  org.codehaus.jackson.JsonGenerator
 *  org.codehaus.jackson.JsonProcessingException
 *  org.codehaus.jackson.map.JsonSerializer
 *  org.codehaus.jackson.map.SerializerProvider
 *  org.springframework.context.i18n.LocaleContextHolder
 *  org.springframework.stereotype.Component
 */

import com.ejie.x38.util.DateTimeManager;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component;

@Component
public class JsonDateSerializer extends JsonSerializer<Date> {
	public void serialize(Date date, JsonGenerator gen,
			SerializerProvider provider) throws IOException,
			JsonProcessingException {
		Locale locale = LocaleContextHolder.getLocale();
		SimpleDateFormat dateFormat = DateTimeManager
				.getDateTimeFormat((Locale) locale);
		String formattedDate = dateFormat.format(date);
		gen.writeString(formattedDate);
	}
}