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

javastrava.json.impl.gson.serializer.AuthorisationApprovalPromptSerializer Maven / Gradle / Ivy

There is a newer version: 2.0.0-alpha
Show newest version
package javastrava.json.impl.gson.serializer;

import java.lang.reflect.Type;

import javastrava.api.v3.auth.ref.AuthorisationApprovalPrompt;

import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;

/**
 * @author Dan Shannon
 *
 */
public class AuthorisationApprovalPromptSerializer implements JsonSerializer,
		JsonDeserializer {

	/**
	 * @see com.google.gson.JsonSerializer#serialize(java.lang.Object, java.lang.reflect.Type,
	 *      com.google.gson.JsonSerializationContext)
	 */
	@Override
	public JsonElement serialize(final AuthorisationApprovalPrompt prompt, final Type type, final JsonSerializationContext context) {
		return context.serialize(prompt.getId());
	}

	/**
	 * @see com.google.gson.JsonDeserializer#deserialize(com.google.gson.JsonElement, java.lang.reflect.Type,
	 *      com.google.gson.JsonDeserializationContext)
	 */
	@Override
	public AuthorisationApprovalPrompt deserialize(final JsonElement element, final Type type, final JsonDeserializationContext context)
			throws JsonParseException {
		return AuthorisationApprovalPrompt.create(element.getAsString());
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy