@VisibleForTesting public <P extends Message> P fromJson(JsonElement json, Class<P> clazz) throws SerializationException { return getSerializer(clazz).fromJson(json, null, gson); } }
/** * Serializes a proto to JSON. Only protos whose classes have been registered * will be serialized. * * @throws SerializationException if the class of {@code message} has not been * registered. */ public <P extends Message>JsonElement toJson(P message) throws SerializationException { return getSerializer(message.getClass()).toGson(message, null, gson); }
/** * Deserializes a proto from JSON. Only protos whose classes have been * registered can be deserialized. * * @throws SerializationException if no class called {@code type} has been * registered. */ public Message fromJson(JsonElement json, String type) throws SerializationException { return getSerializer(type).fromJson(json, null, gson); }