/** * Estrategia de exclusion para {@link Gson} para saltarse campos que no sean serializables * @author shujito */ public class ExcludeFieldsWithoutSerializedName implements ExclusionStrategy { @Override public boolean shouldSkipClass(Class<?> clss) { return false; } @Override public boolean shouldSkipField(FieldAttributes fieldAttributes) { // get all annotations, skip these without @SerializedName Collection<Annotation> annotations = fieldAttributes.getAnnotations(); for (Annotation a : annotations) { if (a instanceof SerializedName) { return false; } } return true; } }