com.taobao.weex.bridge.MethodInvoker Java Examples
The following examples show how to use
com.taobao.weex.bridge.MethodInvoker.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TypeModuleFactory.java From weex with Apache License 2.0 | 6 votes |
private void generateMethodMap() { WXLogUtils.d(TAG, "extractMethodNames"); ArrayList<String> methods = new ArrayList<>(); 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 && anno instanceof WXModuleAnno) { methods.add(method.getName()); methodMap.put(method.getName(), new MethodInvoker(method)); break; } } } } catch (Throwable e) { WXLogUtils.e("[WXModuleManager] extractMethodNames:" + e.getStackTrace()); } mMethods = methods; mMethodMap = methodMap; }
Example #2
Source File: ComponentHolder.java From weex with Apache License 2.0 | 5 votes |
private synchronized void generate(){ WXLogUtils.d(TAG,"Generate Component:"+mClz.getSimpleName()); HashMap<String, Invoker> methods = new HashMap<>(); Annotation[] annotations; Annotation anno; for (Method method : mClz.getMethods()) { annotations = method.getDeclaredAnnotations(); for (int i = 0,annotationsCount = annotations.length; i < annotationsCount; ++i) { anno = annotations[i]; if (anno != null && anno instanceof WXComponentProp) { String name = ((WXComponentProp) anno).name(); methods.put(name, new MethodInvoker(method)); break; } } } mMethods = methods; try { mConstructor = mClz.getConstructor(WXSDKInstance.class, WXDomObject.class, WXVContainer.class, boolean.class); } catch (NoSuchMethodException e) { try { //compatible deprecated constructor mConstructor = mClz.getConstructor(WXSDKInstance.class, WXDomObject.class, WXVContainer.class,String.class, boolean.class); } catch (NoSuchMethodException e1) { e1.printStackTrace(); throw new WXRuntimeException("Can't find constructor of component."); } e.printStackTrace(); } }