Package openperipheral.adapter.method

Examples of openperipheral.adapter.method.MethodDeclaration


  private void addMethodsFromObject(Map<String, E> methods, Object target) {
    for (Method method : target.getClass().getMethods()) {
      LuaCallable callableMeta = method.getAnnotation(LuaCallable.class);
      if (callableMeta != null) {
        MethodDeclaration decl = new MethodDeclaration(method, callableMeta);
        for (String name : decl.getNames())
          methods.put(name, createDummyWrapper(target, decl));
      }
    }
  }
View Full Code Here


    public E createExecutor(Method method, MethodDeclaration decl, Map<String, Method> proxyArgs);
  }

  protected MethodDeclaration createDeclaration(Method method) {
    LuaMethod methodAnn = method.getAnnotation(LuaMethod.class);
    if (methodAnn != null) return new MethodDeclaration(method, methodAnn);

    LuaCallable callableAnn = method.getAnnotation(LuaCallable.class);
    if (callableAnn != null) return new MethodDeclaration(method, callableAnn);

    return null;
  }
View Full Code Here

      Log.severe(t, "Can't get adapter %s methods (possible sideness fail), bailing out", adapterClass);
      return result;
    }

    for (Method method : clsMethods) {
      MethodDeclaration decl = createDeclaration(method);

      if (decl == null) continue;

      Map<String, Method> allProxyArgs = Maps.newHashMap();

      Class<?>[] luaArgs = decl.getLuaArgTypes();
      final ProxyArg proxyArg = method.getAnnotation(ProxyArg.class);
      if (proxyArg != null) addProxyArgs(allProxyArgs, method.getName(), luaArgs, proxyArg);

      final ProxyArgs proxyArgs = method.getAnnotation(ProxyArgs.class);
      if (proxyArgs != null) for (ProxyArg arg : proxyArgs.value())
        addProxyArgs(allProxyArgs, method.getName(), luaArgs, arg);

      E exec = factory.createExecutor(method, decl, ImmutableMap.copyOf(allProxyArgs));

      if (!isFreeform(method, clsIsFreeform)) {
        final String[] methodPrefixes = getPrefixes(method, classPrefixes);
        if (methodPrefixes != null) namesFromAnnotation(methodPrefixes, decl);
        else nameDefaultParameters(decl);
      }

      validateArgTypes(decl);
      for (String proxyArgName : allProxyArgs.keySet())
        decl.declareJavaArgType(proxyArgName, IMethodProxy.class);

      decl.validate();

      result.add(exec);
    }

    return result;
View Full Code Here

TOP

Related Classes of openperipheral.adapter.method.MethodDeclaration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.