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

com.windowsazure.messaging.LowerCaseEnumDeserializer Maven / Gradle / Ivy

Go to download

Azure Notification Hubs Java SDK for interacting with the data and management plane operations.

The newest version!
package com.windowsazure.messaging;

import com.google.gson.*;

import java.lang.reflect.Type;

public class LowerCaseEnumDeserializer implements JsonDeserializer {
    @Override
    public Enum deserialize(JsonElement json, Type type, JsonDeserializationContext context)
        throws JsonParseException {
        try {
            if(type instanceof Class && ((Class) type).isEnum()) {
                Gson gson = new GsonBuilder().create();
                return gson.fromJson(json.getAsString().toLowerCase(), type);
            }
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy