Skip to content

Instantly share code, notes, and snippets.

@ChaitanyaPramod
Created March 25, 2018 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChaitanyaPramod/9029890e4127679d3ebd385d0e6d630f to your computer and use it in GitHub Desktop.
Save ChaitanyaPramod/9029890e4127679d3ebd385d0e6d630f to your computer and use it in GitHub Desktop.
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