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

com.oneops.infoblox.model.AutoValueMoshi_JsonAdapterFactory Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
package com.oneops.infoblox.model;

import com.oneops.infoblox.model.host.Host;
import com.oneops.infoblox.model.host.Ipv4Addrs;
import com.oneops.infoblox.model.zone.ZoneAuth;
import com.squareup.moshi.JsonAdapter;
import com.squareup.moshi.Moshi;
import java.lang.Override;
import java.lang.annotation.Annotation;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Set;

public final class AutoValueMoshi_JsonAdapterFactory extends JsonAdapterFactory {
  @Override
  public JsonAdapter create(Type type, Set annotations, Moshi moshi) {
    if (!annotations.isEmpty()) return null;
    if (type instanceof ParameterizedType) {
      Type rawType = ((ParameterizedType) type).getRawType();
      if (rawType.equals(Result.class)) {
        return Result.jsonAdapter(moshi, ((ParameterizedType) type).getActualTypeArguments());
      }
      return null;
    }
    if (type.equals(Ipv4Addrs.class)) {
      return Ipv4Addrs.jsonAdapter(moshi);
    } else if (type.equals(Ref.class)) {
      return Ref.jsonAdapter(moshi);
    } else if (type.equals(Host.class)) {
      return Host.jsonAdapter(moshi);
    } else if (type.equals(Error.class)) {
      return Error.jsonAdapter(moshi);
    } else if (type.equals(ZoneAuth.class)) {
      return ZoneAuth.jsonAdapter(moshi);
    }
    return null;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy