Package alt.jiapi.reflect

Examples of alt.jiapi.reflect.Signature


        log.info("Creating method " + clazz.getName() + "." + methodName);

        JiapiMethod method = null;
        try {
            Signature signature = new Signature(returnType, parameterNames);
            method = clazz.addMethod((short)modifiers, methodName, signature);
        }
        catch (MethodExistsException mee) {
            log.info("method " + clazz.getName() + "." + methodName +
                     " already exists");
View Full Code Here


        System.out.println(clazz);

        // Add an empty method for a clazz. The method signature must
        // match the method from HelloWorld interface, the only difference
        // is that we want to implement the method now so it can't be abstract.
        Signature signature = new Signature("void", new String[] {} );
        JiapiMethod method = clazz.addMethod(Modifier.PUBLIC, "helloWorld",
                                             signature);
       
        // Then create the method body. The body will make a call to
        // System.out.println and then just return.
View Full Code Here

        catch(NoSuchMethodException nsme) {
            // It did not exists, so create one
            try {
                clinit =
                    currentClass.addMethod(Modifier.STATIC, "<clinit>",
                                           new Signature("void",
                                                         new String[0]));
                // create 'return' from <clinit>
                clinit.getInstructionList().add(clinit.getInstructionList().getInstructionFactory().returnMethod(clinit));
            }
            catch(MethodExistsException mee) {
View Full Code Here

        int modifiers = jm.getModifiers();
        if (Modifier.isStatic(modifiers)) {
      // Static methods do not have reference to 'this'
      //view.add(factory.pushNull());
      view.add(factory.pushConstant(jm.getDeclaringClass().getName()));
      view.add(factory.invoke(Modifier.STATIC, "java.lang.Class", "forName", new Signature("java.lang.Class", new String[] {"java.lang.String"})));
        }
        else {
      view.add(factory.aload(0));
        }
                    // NOT IMPLEMENTED
View Full Code Here

    /**
     * Gets the return type.
     */
    public String getReturnType() {
        Signature s = new Signature(getDescriptor());
        return s.getReturnType();
    }
View Full Code Here

    /**
     * Gets names of each parameter types.
     */
    public String[] getParameterTypes() {
        Signature s = new Signature(getDescriptor());
        return s.getParameters();
    }
View Full Code Here

     * @return an Invocation to constructor of primitive wrapper
     */
    private Instruction handlePrimitiveType(String type, InstructionList il) {
        InstructionFactory f = il.getInstructionFactory();
        String cName = null;
        Signature s = new Signature("void", new String[]{ type });

        if ("int".equals(type)) {
            cName = "java.lang.Integer";
        }
        else if ("long".equals(type)) {
View Full Code Here

        //       However, we use this to get Class of the running object,
        //       so its Class is allways found.
        try {
            nl.add(f.pushConstant(name));
            nl.add(f.invoke(Modifier.STATIC, "java.lang.Class",
                            "forName", new Signature("java.lang.Class",
                                                     new String[] {"java.lang.String"})));
        }
        catch(Exception e) {
            e.printStackTrace();
            il.add(f.pushNull());
View Full Code Here

        //       However, we use this to get Class of the running object,
        //       so its Class is allways found.
        try {
            nl.add(f.pushConstant(name));
            nl.add(f.invoke(Modifier.STATIC, "java.lang.Class",
                            "forName", new Signature("java.lang.Class",
                                                     new String[] {"java.lang.String"})));
            nl.add(f.astore(maxLocals));
        }
        catch(Exception e) {
            e.printStackTrace();
View Full Code Here

     * @return an Invocation to constructor of primitive wrapper
     */
    private Instruction handlePrimitiveType(String type, InstructionList il) {
        InstructionFactory f = il.getInstructionFactory();
        String cName = null;
        Signature s = new Signature("void", new String[]{ type });

        if ("int".equals(type)) {
            cName = "java.lang.Integer";
        }
        else if ("long".equals(type)) {
View Full Code Here

TOP

Related Classes of alt.jiapi.reflect.Signature

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.