All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.gesellix.docker.json.CustomObjectAdapterFactory Maven / Gradle / Ivy

There is a newer version: 2024-11-28T22-05-00
Show newest version
package de.gesellix.docker.json;

import com.squareup.moshi.JsonAdapter;
import com.squareup.moshi.Moshi;

import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.Set;

public class CustomObjectAdapterFactory implements JsonAdapter.Factory {

  @Override
  public JsonAdapter create(Type type, Set annotations, Moshi moshi) {

    if (!type.equals(Object.class)) {
      return null;
    }

    JsonAdapter delegate = moshi.nextAdapter(this, Object.class, annotations);
    return new NumberToBigDecimalJsonAdapter(delegate);
  }
}