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

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

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

import java.util.Optional;

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

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

public class GsonFactory {

	private GsonFactory() {
		// Hide constructor as you don't need to create a utility class
	}

	public static Gson create() {
		GsonBuilder builder = new GsonBuilder();
		builder.registerTypeAdapter(Credentials.class, new CredentialsSerializer());
		builder.registerTypeAdapter(Optional.class, new OptionalDeserializer());
		builder.registerTypeAdapter(RequestWrapper.class, new RequestWrapperSerializer());
		return builder.create();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy