Package gri.tasks.java

Examples of gri.tasks.java.MethodDefinition


    String className = classElem == null ?
        null : classElem.getText();

    //constructor:
    Element constructorElem = elem.getChild("constructor");
    MethodDefinition constructorDef = constructorElem == null ?
        null : parseMethod(constructorElem);

    //target method:
    Element methodElem = elem.getChild("method");
    if (methodElem == null)
      throw new InvalidXMLException("Method invocation missing required <method> element");
    MethodDefinition methodDef = parseMethod(methodElem);

    String methodName = methodElem.getAttributeValue("name");
    if (methodName == null)
      throw new InvalidXMLException("<method> element missing required 'name' parameter");
View Full Code Here


        else
          throw new InvalidXMLException("Only one return type can be specified for a method");
      }
    }

    return new MethodDefinition(
        (ParameterDef [])params.toArray(new ParameterDef [] {}),
        returnType
    );
  }
View Full Code Here

     *  
     */
    public static void test1() throws Exception {
      //define a method of type: 
      //  String method(String text)
        MethodDefinition methodDef = new MethodDefinition();
       
        ParameterDef inDef = new ParameterDef("text", Types.STRING);
        ParameterDef outDef = new ParameterDef("output", Types.STRING);
        methodDef.setParameterDefs(new ParameterDef [] {inDef});
        methodDef.setReturnType(outDef);
       
        //acquire method reference:
        test_java obj = new test_java();
        Method upper = obj.getClass().getMethod("upper", new Class [] {String.class});
        Method lower = test_java.class.getMethod("lower", new Class [] {String.class});
View Full Code Here

        Method targetMethod = targetClass.getMethod("write", new Class [] {String.class});
        Constructor constructor = targetClass.getConstructor(new Class [] {String.class});
       
        //define method:
        //    String write(String message)
        MethodDefinition targetMethodDef = new MethodDefinition();
        ParameterDef inDef = new ParameterDef("message", Types.STRING);
        ParameterDef outDef = new ParameterDef("output", Types.STRING);
        targetMethodDef.setParameterDefs(new ParameterDef [] {inDef});
        targetMethodDef.setReturnType(outDef);
       
        //define constructor:
        //     TestClass(String prefix)
        MethodDefinition constructorDef = new MethodDefinition();
        ParameterDef prefixDef = new ParameterDef("prefix", Types.STRING);
        constructorDef.setParameterDefs(new ParameterDef [] {prefixDef});
       
        //define property bindings:
        //    void   setSuffix(String suffix)
        //    String getValue()
        PropertyBindingDef propertyDef = new PropertyBindingDef();
View Full Code Here

TOP

Related Classes of gri.tasks.java.MethodDefinition

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.