Package org.coliper.ibean.extension
Interface GsonSupport
-
public interface GsonSupport
Extension interface that makes IBeans serializable and deserializable with Gson. If an IBean interface extendsGsonSupport
you are able to convert any IBean instance from and to JSON. For this to work you need another two prerequisites:- Gson with version 2.4 or higher need to be in the classpath.
GsonSerializerDeserializerForIBeans
needs to be registered in the usedGson
. SeeGsonSerializerDeserializerForIBeans
for details.
- See Also:
Gson
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
readFromJsonObject(JsonObject jsonObject, JsonDeserializationContext context)
Reads the field values from aJsonObject
and sets the fields of this IBean to the retrieved values.void
writeToJsonObject(JsonObject jsonObject, JsonSerializationContext context)
Writes the field values of this IBean out into a JsonObject.
-
-
-
Method Detail
-
readFromJsonObject
void readFromJsonObject(JsonObject jsonObject, JsonDeserializationContext context)
Reads the field values from aJsonObject
and sets the fields of this IBean to the retrieved values.You normally do not use this method directly. It is mainly called from
GsonSerializerDeserializerForIBeans
during JSON deserialization.- Parameters:
jsonObject
- theJsonObject
reading some JSON representation of this IBeancontext
- the Gson deserialization context
-
writeToJsonObject
void writeToJsonObject(JsonObject jsonObject, JsonSerializationContext context)
Writes the field values of this IBean out into a JsonObject.You normally do not use this method directly. It is mainly called from
GsonSerializerDeserializerForIBeans
during JSON serialization.- Parameters:
jsonObject
- the target where to write the field value tocontext
- the Gson serialization context
-
-