Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
private static Unbinder createBinding(@NonNull Object target, @NonNull View source) {
Class<?> targetClass = target.getClass();
...
Constructor<? extends Unbinder> constructor = findBindingConstructorForClass(targetClass);
...
try {
return constructor.newInstance(target, source);
}
...
}
@Nullable @CheckResult @UiThread
private static Constructor<? extends Unbinder> findBindingConstructorForClass(Class<?> cls) {
Constructor<? extends Unbinder> bindingCtor;
... // Removed cache code
String clsName = cls.getName();
...
try {
Class<?> bindingClass = cls.getClassLoader().loadClass(clsName + "_ViewBinding");
...
bindingCtor = (Constructor<? extends Unbinder>) bindingClass.getConstructor(cls, View.class);
...
}
...
return bindingCtor;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment