Give a nice toString on type adapter factories to make debugging easier.
This commit is contained in:
parent
90c9eadda1
commit
94d59b550e
@ -696,6 +696,9 @@ public final class TypeAdapters {
|
||||
public <T> TypeAdapter<T> create(MiniGson context, TypeToken<T> typeToken) {
|
||||
return typeToken.getRawType() == type ? (TypeAdapter<T>) typeAdapter : null;
|
||||
}
|
||||
@Override public String toString() {
|
||||
return "Factory[type=" + type.getName() + ",adapter=" + typeAdapter + "]";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -707,6 +710,10 @@ public final class TypeAdapters {
|
||||
Class<? super T> rawType = typeToken.getRawType();
|
||||
return (rawType == unboxed || rawType == boxed) ? (TypeAdapter<T>) typeAdapter : null;
|
||||
}
|
||||
@Override public String toString() {
|
||||
return "Factory[type=" + boxed.getName()
|
||||
+ "+" + unboxed.getName() + ",adapter=" + typeAdapter + "]";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -718,6 +725,10 @@ public final class TypeAdapters {
|
||||
Class<? super T> rawType = typeToken.getRawType();
|
||||
return (rawType == base || rawType == sub) ? (TypeAdapter<T>) typeAdapter : null;
|
||||
}
|
||||
@Override public String toString() {
|
||||
return "Factory[type=" + base.getName()
|
||||
+ "+" + sub.getName() + ",adapter=" + typeAdapter + "]";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -728,6 +739,9 @@ public final class TypeAdapters {
|
||||
public <T> TypeAdapter<T> create(MiniGson context, TypeToken<T> typeToken) {
|
||||
return clazz.isAssignableFrom(typeToken.getRawType()) ? (TypeAdapter<T>) typeAdapter : null;
|
||||
}
|
||||
@Override public String toString() {
|
||||
return "Factory[typeHierarchy=" + clazz.getName() + ",adapter=" + typeAdapter + "]";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user