Code example for Excluder

Methods: excludeClassexcludeField

0
    this.fieldNamingPolicy = fieldNamingPolicy;
    this.excluder = excluder;
  } 
 
  public boolean excludeField(Field f, boolean serialize) {
    return !excluder.excludeClass(f.getType(), serialize) && !excluder.excludeField(f, serialize);
  } 
 
  private String getFieldName(Field f) {
    SerializedName serializedName = f.getAnnotation(SerializedName.class);
    return serializedName == null ? fieldNamingPolicy.translateName(f) : serializedName.value();
  } 
 
  public <T> TypeAdapter<T> create(Gson gson, final TypeToken<T> type) {
    Class<? super T> raw = type.getRawType();
 
    if (!Object.class.isAssignableFrom(raw)) {
      return null; // it's a primitive! 
    } 
 
Experience pair programming with AI  Get Codota for Java