public static WrappedStack createFromJson(String jsonWrappedObject) throws JsonParseException { try { return jsonSerializer.fromJson(jsonWrappedObject, WrappedStack.class); } catch (JsonSyntaxException exception) { exception.printStackTrace(); } catch (JsonParseException exception) { exception.printStackTrace(); } return null; }
protected List<CardData> loadRawData() { try { return gson.fromJson(readLibrarySource(), getType()); } catch (JsonIOException e) { e.printStackTrace(); } catch (JsonSyntaxException e) { e.printStackTrace(); } catch (FileNotFoundException e) { e.printStackTrace(); } return Collections.emptyList(); }
/** * Deserializes an EmcValue object from the given serialized json String * * @param jsonEnergyValue Json encoded String representing a EmcValue object * @return The EmcValue that was encoded as json, or null if a valid EmcValue could not be decoded * from given String */ @SuppressWarnings("unused") public static EnergyValue createFromJson(String jsonEnergyValue) { try { return jsonSerializer.fromJson(jsonEnergyValue, EnergyValue.class); } catch (JsonSyntaxException exception) { exception.printStackTrace(); } catch (JsonParseException exception) { exception.printStackTrace(); } return null; }
@Override public Deck loadDeck(String name) { DeckData data; try { data = gson.fromJson(readSource(getDeckUri(name)), DeckData.class); CardLibrary cl = loadCardLibrary(); Card identityCard = cl.getCard(data.getIdentity()); Deck deck = new Deck(cl.getItentity(identityCard.getKey()), data.getName()); for (CardRef ref : data.getCards()) { deck.add(cl.getCard(ref.getCard()), ref.getCount()); } return deck; } catch (JsonIOException e) { e.printStackTrace(); } catch (JsonSyntaxException e) { e.printStackTrace(); } catch (FileNotFoundException e) { e.printStackTrace(); } return null; }