Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.robrua.orianna.api.dto;
 
 import java.util.List;
 
    private static final Gson GSON = new Gson();
    @SuppressWarnings("unchecked")
    @Override
    public SummonerSpell deserialize(final JsonElement jsonfinal Type typefinal JsonDeserializationContext contextthrows JsonParseException {
        final JsonObject obj = json.getAsJsonObject();
        final SummonerSpell spell = new SummonerSpell();
        Type t;
        t = new TypeToken<List<Double>>() {}.getType();
        spell.setCooldown((List<Double>).fromJson(obj.get("cooldown"), t));
        spell.setCooldownBurn(.fromJson(obj.get("cooldownBurn"), String.class));
        spell.setCostBurn(.fromJson(obj.get("costBurn"), String.class));
        spell.setCostType(.fromJson(obj.get("costType"), String.class));
        spell.setDescription(.fromJson(obj.get("description"), String.class));
        spell.setKey(.fromJson(obj.get("key"), String.class));
        spell.setName(.fromJson(obj.get("name"), String.class));
        spell.setRangeBurn(.fromJson(obj.get("rangeBurn"), String.class));
        spell.setResource(.fromJson(obj.get("resource"), String.class));
        spell.setSanitizedDescription(.fromJson(obj.get("sanitizedDescription"), String.class));
        spell.setSanitizedTooltip(.fromJson(obj.get("sanitizedTooltip"), String.class));
        spell.setTooltip(.fromJson(obj.get("tooltip"), String.class));
        t = new TypeToken<List<Integer>>() {}.getType();
        spell.setCost((List<Integer>).fromJson(obj.get("cost"), t));
        try {
            spell.setRange((List<Integer>).fromJson(obj.get("range"), t));
        }
        catch(final JsonSyntaxException e) {
            spell.setRange(null);
        }
        t = new TypeToken<List<List<Double>>>() {}.getType();
        spell.setEffect((List<List<Double>>).fromJson(obj.get("effect"), t));
        t = new TypeToken<List<String>>() {}.getType();
        spell.setEffectBurn((List<String>).fromJson(obj.get("effectBurn"), t));
        spell.setModes((List<String>).fromJson(obj.get("modes"), t));
        spell.setImage(.fromJson(obj.get("image"), Image.class));
        spell.setLeveltip(.fromJson(obj.get("leveltip"), LevelTip.class));
        spell.setMaxrank(.fromJson(obj.get("maxrank"), Integer.class));
        spell.setId(.fromJson(obj.get("id"), Integer.class));
        spell.setSummonerLevel(.fromJson(obj.get("summonerLevel"), Integer.class));
        t = new TypeToken<List<SpellVars>>() {}.getType();
        spell.setVars((List<SpellVars>).fromJson(obj.get("vars"), t));
        return spell;
    }
New to GrepCode? Check out our FAQ X