Package alt.jiapi.reflect

Examples of alt.jiapi.reflect.InstructionFactory.invoke()


                er.getDeclaredMethod("getFieldValue",
                                     new String[] {"java.lang.String"});

            // Get the field value from runtime
            initializer.add(factory.pushConstant(fieldName));
            initializer.add(factory.invoke(gfv));


            // put the returned event producer to __jiapi_field
            initializer.add(factory.cast(ep.getClass().getName()));
            initializer.add(factory.setField(eventProducerField));
View Full Code Here


                pTypes[i] = hpTypes[i].getName();
            }
           
            JiapiMethod hMethod =hClass.getDeclaredMethod(hookMethod.getName(),
                                                          pTypes);
            il.add(factory.invoke(hMethod));
        }
        catch(Exception e) {
            log.error("Failed to add invoke instruction: " + e);
        }
    }
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

//                 nList.add(factory.pushConstant(ins.getDescriptor()));
                // Add cache-key
                nList.add(factory.pushConstant(ins.getClassName() + ins.getMethodName() + ins.getDescriptor()));

                // call Interceptor
                nList.add(factory.invoke(invokeMethod));

                handleReturnValue(nList, ins);


                // Replace invocation and its parameters with new
View Full Code Here

            cName = "java.lang.Double";
        }

         il.add(f.newClass(cName));
         il.add(f.dup());
         Instruction ins = f.invoke(Modifier.PUBLIC, cName, "<init>", s);
         return ins;
    }


    private void handleReturnValue(InstructionList il, Invocation ins) {
View Full Code Here

                JiapiClass jc = new Loader().loadClass("java.lang.Integer");
                JiapiMethod jm =
                    jc.getDeclaredMethod("intValue", new String[0]);

                il.add(factory.cast("java.lang.Integer"));
                il.add(factory.invoke(jm));
            }
            catch(Exception e) {
                e.printStackTrace();
            }
        }
View Full Code Here

                JiapiClass jc = new Loader().loadClass("java.lang.Long");
                JiapiMethod jm =
                    jc.getDeclaredMethod("longValue", new String[0]);

                il.add(factory.cast("java.lang.Long"));
                il.add(factory.invoke(jm));
            }
            catch(Exception e) {
                e.printStackTrace();
            }
        }
View Full Code Here

                JiapiClass jc = new Loader().loadClass("java.lang.Character");
                JiapiMethod jm =
                    jc.getDeclaredMethod("charValue", new String[0]);

                il.add(factory.cast("java.lang.Character"));
                il.add(factory.invoke(jm));
            }
            catch(Exception e) {
                e.printStackTrace();
            }
        }
View Full Code Here

                JiapiClass jc = new Loader().loadClass("java.lang.Boolean");
                JiapiMethod jm =
                    jc.getDeclaredMethod("booleanValue", new String[0]);

                il.add(factory.cast("java.lang.Boolean"));
                il.add(factory.invoke(jm));
            }
            catch(Exception e) {
                e.printStackTrace();
            }
        }
View Full Code Here

                JiapiClass jc = new Loader().loadClass("java.lang.Byte");
                JiapiMethod jm =
                    jc.getDeclaredMethod("byteValue", new String[0]);

                il.add(factory.cast("java.lang.Byte"));
                il.add(factory.invoke(jm));
            }
            catch(Exception e) {
                e.printStackTrace();
            }
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.