public <T> T deserializeAs(PersistedData data, Class<T> type) {
GsonPersistedData gsonData = (GsonPersistedData) data;
try {
return context.deserialize(gsonData.getElement(), type);
} catch (JsonParseException jpe) {
throw new DeserializationException("Failed to deserialize data as " + type, jpe);
}
}