@Override public boolean equals(Object other) { return other instanceof WildcardType && Types.equals(this, (WildcardType) other); }
public static boolean typesMatch(Type pattern, Type candidate) { // TODO: permit raw types (like Set.class) to match non-raw candidates (like Set<Long>). return Types.equals(pattern, candidate); }
@Override public boolean equals(Object other) { return other instanceof ParameterizedType && Types.equals(this, (ParameterizedType) other); }
@Override public boolean equals(Object o) { return o instanceof GenericArrayType && Types.equals(this, (GenericArrayType) o); }
/** Returns the matching adapter method from the list. */ private static @Nullable AdapterMethod get( List<AdapterMethod> adapterMethods, Type type, Set<? extends Annotation> annotations) { for (int i = 0, size = adapterMethods.size(); i < size; i++) { AdapterMethod adapterMethod = adapterMethods.get(i); if (Types.equals(adapterMethod.type, type) && adapterMethod.annotations.equals(annotations)) { return adapterMethod; } } return null; }
public void bind(Moshi moshi, JsonAdapter.Factory factory) { if (jsonAdapters.length > 0) { Type[] parameterTypes = method.getGenericParameterTypes(); Annotation[][] parameterAnnotations = method.getParameterAnnotations(); for (int i = adaptersOffset, size = parameterTypes.length; i < size; i++) { Type type = ((ParameterizedType) parameterTypes[i]).getActualTypeArguments()[0]; Set<? extends Annotation> jsonAnnotations = jsonAnnotations(parameterAnnotations[i]); jsonAdapters[i - adaptersOffset] = Types.equals(this.type, type) && annotations.equals(jsonAnnotations) ? moshi.nextAdapter(factory, type, jsonAnnotations) : moshi.adapter(type, jsonAnnotations); } } }
return equals(((Class) a).getComponentType(), ((GenericArrayType) b).getGenericComponentType()); ? ((ParameterizedTypeImpl) pb).typeArguments : pb.getActualTypeArguments(); return equals(pa.getOwnerType(), pb.getOwnerType()) && pa.getRawType().equals(pb.getRawType()) && Arrays.equals(aTypeArguments, bTypeArguments); return equals(((Class) b).getComponentType(), ((GenericArrayType) a).getGenericComponentType()); GenericArrayType ga = (GenericArrayType) a; GenericArrayType gb = (GenericArrayType) b; return equals(ga.getGenericComponentType(), gb.getGenericComponentType());
@Override public void bind(Moshi moshi, JsonAdapter.Factory factory) { super.bind(moshi, factory); delegate = Types.equals(parameterTypes[0], returnType) && qualifierAnnotations.equals(returnTypeAnnotations) ? moshi.nextAdapter(factory, parameterTypes[0], qualifierAnnotations) : moshi.adapter(parameterTypes[0], qualifierAnnotations); }
@Override public void bind(Moshi moshi, JsonAdapter.Factory factory) { super.bind(moshi, factory); delegate = Types.equals(parameterTypes[0], returnType) && qualifierAnnotations.equals(returnTypeAnnotations) ? moshi.nextAdapter(factory, returnType, returnTypeAnnotations) : moshi.adapter(returnType, returnTypeAnnotations); }
@Override public boolean equals(Object o) { return o instanceof GenericArrayType && Types.equals(this, (GenericArrayType) o); }
public static boolean typesMatch(Type pattern, Type candidate) { // TODO: permit raw types (like Set.class) to match non-raw candidates (like Set<Long>). return Types.equals(pattern, candidate); }
@Override public boolean equals(Object other) { return other instanceof WildcardType && Types.equals(this, (WildcardType) other); }
@Override public boolean equals(Object other) { return other instanceof ParameterizedType && Types.equals(this, (ParameterizedType) other); }
/** Returns the matching adapter method from the list. */ private static @Nullable AdapterMethod get( List<AdapterMethod> adapterMethods, Type type, Set<? extends Annotation> annotations) { for (int i = 0, size = adapterMethods.size(); i < size; i++) { AdapterMethod adapterMethod = adapterMethods.get(i); if (Types.equals(adapterMethod.type, type) && adapterMethod.annotations.equals(annotations)) { return adapterMethod; } } return null; }
public void bind(Moshi moshi, JsonAdapter.Factory factory) { if (jsonAdapters.length > 0) { Type[] parameterTypes = method.getGenericParameterTypes(); Annotation[][] parameterAnnotations = method.getParameterAnnotations(); for (int i = adaptersOffset, size = parameterTypes.length; i < size; i++) { Type type = ((ParameterizedType) parameterTypes[i]).getActualTypeArguments()[0]; Set<? extends Annotation> jsonAnnotations = jsonAnnotations(parameterAnnotations[i]); jsonAdapters[i - adaptersOffset] = Types.equals(this.type, type) && annotations.equals(jsonAnnotations) ? moshi.nextAdapter(factory, type, jsonAnnotations) : moshi.adapter(type, jsonAnnotations); } } }
@Override public JsonAdapter<?> create(Type requestedType, Set<? extends Annotation> annotations, Moshi moshi) { if (Types.equals(type, requestedType)) { JsonAdapter<T> delegate = moshi.nextAdapter(this, type, annotations); return new DefaultOnDataMismatchAdapter<>(delegate, defaultValue); } return null; } };
return equals(((Class) a).getComponentType(), ((GenericArrayType) b).getGenericComponentType()); ? ((ParameterizedTypeImpl) pb).typeArguments : pb.getActualTypeArguments(); return equals(pa.getOwnerType(), pb.getOwnerType()) && pa.getRawType().equals(pb.getRawType()) && Arrays.equals(aTypeArguments, bTypeArguments); return equals(((Class) b).getComponentType(), ((GenericArrayType) a).getGenericComponentType()); GenericArrayType ga = (GenericArrayType) a; GenericArrayType gb = (GenericArrayType) b; return equals(ga.getGenericComponentType(), gb.getGenericComponentType());
@Override public void bind(Moshi moshi, JsonAdapter.Factory factory) { super.bind(moshi, factory); delegate = Types.equals(parameterTypes[0], returnType) && qualifierAnnotations.equals(returnTypeAnnotations) ? moshi.nextAdapter(factory, parameterTypes[0], qualifierAnnotations) : moshi.adapter(parameterTypes[0], qualifierAnnotations); }
@Override public void bind(Moshi moshi, JsonAdapter.Factory factory) { super.bind(moshi, factory); delegate = Types.equals(parameterTypes[0], returnType) && qualifierAnnotations.equals(returnTypeAnnotations) ? moshi.nextAdapter(factory, returnType, returnTypeAnnotations) : moshi.adapter(returnType, returnTypeAnnotations); }