コード例 #1
0
 /**
  * Deserializes the json as an object of the <code>resultType</code> type.
  *
  * @param resultType the parameterized type of the object once deserialized.
  * @param json the json to deserialize.
  * @param <R> the type of the object once deserialized
  * @return The deserialized object.
  */
 protected <R> R deserializeValue(String resultType, String json) {
   return serialization.deserialize(json, resultType);
 }
コード例 #2
0
 /**
  * Serialize the given object. We assume {@link #canSerialize(String)} returns <code>true</code>
  * or a runtime exception may be thrown.
  *
  * @param object the object to serialize.
  * @param bodyType The parameterized type of the object to serialize.
  * @return The serialized string.
  */
 protected String serialize(Object object, String bodyType) {
   return serialization.serialize(object, bodyType);
 }
コード例 #3
0
 /**
  * Verify if the provided <code>resultType</code> can be deserialized.
  *
  * @param resultType the parameterized type to verify if it can be deserialized.
  * @return <code>true</code> if <code>resultType</code> can be deserialized, <code>false</code>
  *     otherwise.
  */
 protected boolean canDeserialize(String resultType) {
   return serialization.canDeserialize(resultType);
 }
コード例 #4
0
 /**
  * Verify if the provided <code>bodyType</code> can be serialized.
  *
  * @param bodyType the parameterized type to verify if it can be serialized.
  * @return <code>true</code> if <code>bodyType</code> can be serialized, otherwise <code>false
  *     </code>.
  */
 protected boolean canSerialize(String bodyType) {
   return serialization.canSerialize(bodyType);
 }