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

org.johnnei.enjin.internal.gson.CredentialsSerializer Maven / Gradle / Ivy

The newest version!
package org.johnnei.enjin.internal.gson;

import java.lang.reflect.Type;

import org.johnnei.enjin.spec.dto.Credentials;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;

public class CredentialsSerializer implements JsonSerializer {

	@Override
	public JsonElement serialize(Credentials src, Type typeOfSrc, JsonSerializationContext context) {
		JsonObject obj = new JsonObject();
		obj.addProperty("email", src.getEmail());
		obj.addProperty("password", new String(src.getPassword()));
		return obj;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy