Polish
This commit is contained in:
parent
b1e90fdca9
commit
07ebfc036b
|
@ -192,14 +192,6 @@ class JavaBeanBinder implements BeanBinder {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isOfDifferentType(ResolvableType targetType,
|
|
||||||
Class<?> resolvedType) {
|
|
||||||
if (this.type.hasGenerics() || targetType.hasGenerics()) {
|
|
||||||
return !this.type.equals(targetType);
|
|
||||||
}
|
|
||||||
return this.resolvedType == null || !this.resolvedType.equals(resolvedType);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static <T> Bean<T> get(Bindable<T> bindable, boolean canCallGetValue) {
|
public static <T> Bean<T> get(Bindable<T> bindable, boolean canCallGetValue) {
|
||||||
ResolvableType type = bindable.getType();
|
ResolvableType type = bindable.getType();
|
||||||
|
@ -214,7 +206,7 @@ class JavaBeanBinder implements BeanBinder {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Bean<?> bean = Bean.cached;
|
Bean<?> bean = Bean.cached;
|
||||||
if (bean == null || bean.isOfDifferentType(type, resolvedType)) {
|
if (bean == null || !bean.isOfType(type, resolvedType)) {
|
||||||
bean = new Bean<>(type, resolvedType);
|
bean = new Bean<>(type, resolvedType);
|
||||||
cached = bean;
|
cached = bean;
|
||||||
}
|
}
|
||||||
|
@ -234,6 +226,13 @@ class JavaBeanBinder implements BeanBinder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isOfType(ResolvableType type, Class<?> resolvedType) {
|
||||||
|
if (this.type.hasGenerics() || type.hasGenerics()) {
|
||||||
|
return this.type.equals(type);
|
||||||
|
}
|
||||||
|
return this.resolvedType != null && this.resolvedType.equals(resolvedType);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class BeanSupplier<T> implements Supplier<T> {
|
private static class BeanSupplier<T> implements Supplier<T> {
|
||||||
|
|
Loading…
Reference in New Issue