use of org.robobinding.viewbinding.ViewBinding in project RoboBinding by RoboBinding.
the class ViewBindingLoader method load.
@SuppressWarnings("unchecked")
public <ViewType> ViewBinding<ViewType> load(CustomViewBinding<ViewType> customViewBinding) {
String viewBindingClassName = getViewBindingClassName(customViewBinding.getClass().getName());
Class<?> viewBindingType;
try {
viewBindingType = Class.forName(viewBindingClassName);
} catch (ClassNotFoundException e) {
throw new RuntimeException(MessageFormat.format("The source code for ''{0}'' is not generated. Is Java annotation processing(source code generation) correctly configured?", viewBindingClassName));
}
try {
return (ViewBinding<ViewType>) ConstructorUtils.invokeConstructor(viewBindingType, customViewBinding);
} catch (NoSuchMethodException e) {
throw new Bug("This is a bug of constructor code generation", e);
} catch (IllegalAccessException e) {
throw new Bug("This is a bug of constructor code generation", e);
} catch (InvocationTargetException e) {
throw new Bug("This is a bug of constructor code generation", e);
} catch (InstantiationException e) {
throw new Bug("This is a bug of constructor code generation", e);
}
}
Aggregations