List of usage examples for com.google.gson JsonElement toString
@Override
public String toString()
From source file:com.nimbits.server.gson.deserializer.ConnectionDeserializer.java
License:Apache License
@Override public Connection deserialize(final JsonElement jsonElement, final Type type, final JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { final String json = jsonElement.toString(); Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); return gson.fromJson(json, ConnectionModel.class); }
From source file:com.nimbits.server.gson.deserializer.EntityDeserializer.java
License:Apache License
@Override public Entity deserialize(final JsonElement jsonElement, final Type type, final JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { final String json = jsonElement.toString(); Map jsonMap = GsonFactory.getInstance(true).fromJson(json, Map.class); int t = Double.valueOf(String.valueOf(jsonMap.get("entityType"))).intValue(); EntityType entityType = EntityType.get(t); return (Entity) GsonFactory.getInstance(true).fromJson(json, entityType.getClz()); }
From source file:com.nimbits.server.gson.deserializer.InstanceDeserializer.java
License:Apache License
@Override public Instance deserialize(final JsonElement jsonElement, final Type type, final JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { final String json = jsonElement.toString(); Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); return gson.fromJson(json, InstanceModel.class); }
From source file:com.nimbits.server.gson.deserializer.ScheduleDeserializer.java
License:Apache License
@Override public Schedule deserialize(final JsonElement jsonElement, final Type type, final JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { final String json = jsonElement.toString(); Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); return gson.fromJson(json, ScheduleModel.class); }
From source file:com.nimbits.server.gson.deserializer.SessionDeserializer.java
License:Apache License
@Override public User deserialize(final JsonElement jsonElement, final Type type, final JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { final String json = jsonElement.toString(); Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); return gson.fromJson(json, UserModel.class); }
From source file:com.nimbits.server.gson.deserializer.SocketDeserializer.java
License:Apache License
@Override public Socket deserialize(final JsonElement jsonElement, final Type type, final JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { final String json = jsonElement.toString(); Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); return gson.fromJson(json, SocketModel.class); }
From source file:com.nimbits.server.gson.deserializer.SubscriptionDeserializer.java
License:Apache License
@Override public Subscription deserialize(final JsonElement jsonElement, final Type type, final JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { final String json = jsonElement.toString(); Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); return gson.fromJson(json, SubscriptionModel.class); }
From source file:com.nimbits.server.gson.deserializer.SummaryDeserializer.java
License:Apache License
@Override public Summary deserialize(final JsonElement jsonElement, final Type type, final JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { final String json = jsonElement.toString(); Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); return gson.fromJson(json, SummaryModel.class); }
From source file:com.nimbits.server.gson.deserializer.SyncDeserializer.java
License:Apache License
@Override public Sync deserialize(final JsonElement jsonElement, final Type type, final JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { final String json = jsonElement.toString(); Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); return gson.fromJson(json, SyncModel.class); }
From source file:com.nimbits.server.gson.EntityDeserializer.java
License:Apache License
@Override public Entity deserialize(final JsonElement jsonElement, final Type type, final JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { final String json; if (jsonElement.isJsonPrimitive()) { final JsonPrimitive jsonPrimitive = (JsonPrimitive) jsonElement; json = jsonPrimitive.getAsString(); } else {/*from www .j av a 2s. c o m*/ json = jsonElement.toString(); } return new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().fromJson(json, EntityModel.class); }