Package org.coliper.ibean.extension
Interface GsonSupport
-
public interface GsonSupportExtension interface that makes IBeans serializable and deserializable with Gson. If an IBean interface extendsGsonSupportyou 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.
GsonSerializerDeserializerForIBeansneeds to be registered in the usedGson. SeeGsonSerializerDeserializerForIBeansfor details.
- See Also:
Gson
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidreadFromJsonObject(JsonObject jsonObject, JsonDeserializationContext context)Reads the field values from aJsonObjectand sets the fields of this IBean to the retrieved values.voidwriteToJsonObject(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 aJsonObjectand sets the fields of this IBean to the retrieved values.You normally do not use this method directly. It is mainly called from
GsonSerializerDeserializerForIBeansduring JSON deserialization.- Parameters:
jsonObject- theJsonObjectreading 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
GsonSerializerDeserializerForIBeansduring JSON serialization.- Parameters:
jsonObject- the target where to write the field value tocontext- the Gson serialization context
-
-