use of com.taobao.weex.common.WXModuleAnno in project incubator-weex by apache.
the class ConfigModuleFactory method generateMethodMap.
private void generateMethodMap() {
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.d(TAG, "extractMethodNames:" + mClazz.getSimpleName());
}
HashMap<String, Invoker> methodMap = new HashMap<>();
try {
for (Method method : mClazz.getMethods()) {
// iterates all the annotations available in the method
for (Annotation anno : method.getDeclaredAnnotations()) {
if (anno != null) {
if (anno instanceof JSMethod) {
JSMethod methodAnnotation = (JSMethod) anno;
String name = JSMethod.NOT_SET.equals(methodAnnotation.alias()) ? method.getName() : methodAnnotation.alias();
methodMap.put(name, new MethodInvoker(method, methodAnnotation.uiThread()));
break;
} else if (anno instanceof WXModuleAnno) {
WXModuleAnno methodAnnotation = (WXModuleAnno) anno;
methodMap.put(method.getName(), new MethodInvoker(method, methodAnnotation.runOnUIThread()));
break;
}
}
}
}
} catch (Throwable e) {
WXLogUtils.e("[WXModuleManager] extractMethodNames:", e);
}
mMethodMap = methodMap;
}
Aggregations