
br.com.moip.utilities.ApiDateSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sdk-java Show documentation
Show all versions of sdk-java Show documentation
Java SDK for Moip APIs integration
The newest version!
package br.com.moip.utilities;
import br.com.moip.api.request.APIDateRequest;
import com.google.gson.JsonElement;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import java.lang.reflect.Type;
import java.text.SimpleDateFormat;
class ApiDateSerializer implements JsonSerializer {
/**
*
* @param src
* @param typeOfSrc
* @param context
* @return
*/
@Override
public JsonElement serialize(APIDateRequest src, Type typeOfSrc, JsonSerializationContext context) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
return new JsonPrimitive(format.format(src.getDate()));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy