T
- type of base entity to serialize and deserialize.public abstract class AbstractBaseEntityCodec<T extends BaseEntity> extends AbstractCodec<T>
BaseEntity
.Constructor and Description |
---|
AbstractBaseEntityCodec() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
addChildFields(T entity,
com.google.gson.JsonObject jsonObj,
com.google.gson.JsonSerializationContext context)
Add child specific fields to the json object.
|
T |
deserialize(com.google.gson.JsonElement json,
Type type,
com.google.gson.JsonDeserializationContext context) |
protected abstract BaseEntity.Builder<T> |
getBuilder(com.google.gson.JsonObject jsonObj,
com.google.gson.JsonDeserializationContext context)
Get a builder initialized with child specific fields.
|
com.google.gson.JsonElement |
serialize(T entity,
Type type,
com.google.gson.JsonSerializationContext context) |
public com.google.gson.JsonElement serialize(T entity, Type type, com.google.gson.JsonSerializationContext context)
public T deserialize(com.google.gson.JsonElement json, Type type, com.google.gson.JsonDeserializationContext context) throws com.google.gson.JsonParseException
com.google.gson.JsonParseException
protected abstract void addChildFields(T entity, com.google.gson.JsonObject jsonObj, com.google.gson.JsonSerializationContext context)
entity
- entity being serializedjsonObj
- object that should be populated with child specific fieldscontext
- context for serializationprotected abstract BaseEntity.Builder<T> getBuilder(com.google.gson.JsonObject jsonObj, com.google.gson.JsonDeserializationContext context)
jsonObj
- object that is being deserializedcontext
- context for deserializationCopyright © 2013-2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.