Examples of MethodInvocation


Examples of net.sourceforge.javautil.bytecode.api.type.method.invocation.MethodInvocation

  public IBytecodeResolvable getDeclaringType() { return this.declaringType; }

  public TypeMemberAccess getAccess() { return TypeMemberAccess.getFor(field.getModifiers()); }

  public MethodInvocation createInvocation(BytecodeContextMethod context, String name, IBytecodeReferenceable... parameters) {
    return new MethodInvocation(this, getType(context).findMethod(context.getResolutionPool(), name, context.getTypes(parameters)), parameters);
  }
View Full Code Here

Examples of net.sourceforge.javautil.bytecode.api.type.method.invocation.MethodInvocation

  public String getName() { return name; }

  public TypeMemberAccess getAccess() { return this.access; }

  public MethodInvocation createInvocation(BytecodeContextMethod context, String name, IBytecodeReferenceable... parameters) {
    return new MethodInvocation(this, getType(context).findMethod(context.getResolutionPool(), name, context.getTypes(parameters)), parameters);
  }
View Full Code Here

Examples of net.sourceforge.javautil.bytecode.api.type.method.invocation.MethodInvocation

   * @param method The method to invoke
   * @param parameters The parameters to pass to the invocation
   * @return The return value
   */
  public MethodInvocation createInvocation (IBytecodeReferenceable instance, IBytecodeMethod method, IBytecodeReferenceable... parameters) {
    return new MethodInvocation(instance, method, parameters);
  }
View Full Code Here

Examples of net.sourceforge.javautil.bytecode.api.type.method.invocation.MethodInvocation

   * @param type The type the constructor is for
   * @param parameters The parameters to pass to the constructor
   * @return The method invocation for the constructor
   */
  public MethodInvocation createConstructorInvocation (IBytecodeReferenceable instance, IBytecodeResolvable type, IBytecodeReferenceable... parameters) {
    return new MethodInvocation(instance, type.findConstructor(this.getResolutionPool(), getTypes(parameters)), parameters);
  }
View Full Code Here

Examples of net.sourceforge.javautil.bytecode.api.type.method.invocation.MethodInvocation

  public TypeDescriptor getType() { return this.descriptor; }

  public IBytecodeResolvable getType(C ctx) { return ctx.getResolutionPool().resolve(descriptor.getClassName()); }

  public MethodInvocation createInvocation(C context, String name, IBytecodeReferenceable... parameters) {
    return new MethodInvocation(this, this.getType(context).findMethod(context.getResolutionPool(), name, context.getTypes(parameters)), parameters);
  }
View Full Code Here

Examples of org.aopalliance.intercept.MethodInvocation

            }
        };

        final Switch methodCalledSwitch = new Switch();

        MethodInvocation invocation = new MethodInvocation() {
            public Method getMethod() {
                return null;
            }

            public Object[] getArguments() {
View Full Code Here

Examples of org.apache.camel.component.bean.MethodInvocation

    protected DefaultParameterMappingStrategy strategy = new DefaultParameterMappingStrategy();
    protected ExampleBean bean = new ExampleBean();
    protected BeanInfo info;

    public void testFindsSingleMethodMatchingBody() throws Throwable {
        MethodInvocation invocation = info.createInvocation(bean, exchange);
        assertNotNull("Should have found a method invocation!", invocation);

        Object value = invocation.proceed();

        LOG.info("Value: " + value);
    }
View Full Code Here

Examples of org.apache.shiro.aop.MethodInvocation

*/
public class ShiroActionFilter implements ActionFilter {

  public View match(final ActionContext actionContext) {
    try {
      ShiroAnnotationsAuthorizingMethodInterceptor.defaultAuth.assertAuthorized(new MethodInvocation() {
       
        public Object proceed() throws Throwable {
          throw Lang.noImplement();
        }
        public Object getThis() {
View Full Code Here

Examples of org.candle.decompiler.intermediate.expression.MethodInvocation

  public void visitWhileIntermediate(WhileIntermediate line) {
    //check to see if the while loop is a method invocation of hasNext.
   
    if(line.getExpression() instanceof SingleConditional) {
      if(((SingleConditional)line.getExpression()).getExpression() instanceof MethodInvocation) {
        MethodInvocation mi = (MethodInvocation)((SingleConditional)line.getExpression()).getExpression();
       
        String iteratorName = null;
        if(mi.getTarget() instanceof Variable) {
          iteratorName = ((Variable)mi.getTarget()).getName();
        }
        else {
          return;
        }
       
        if(StringUtils.equals("hasNext", mi.getMethodName())) {
         
          //probably an iterator.
          List<AbstractIntermediate> predecessors = Graphs.predecessorListOf(igc.getGraph(), line);
         
          //look at the predecessor lines;  validate there are only 2 predecessors.
          if(predecessors.size() == 2) {
            StatementIntermediate declaration = null;
           
            for(AbstractIntermediate predecessor : predecessors) {
              if(comparator.before(predecessor, line)) {
                //should be declaration.
               
                if(predecessor instanceof StatementIntermediate) {
                  declaration = (StatementIntermediate)predecessor;
                  break;
                }
              }
            }
           
            //check to see if the declaration is a temporary variable..
            if(declaration == null) {
              return;
            }
           
           
            //otherwise, let's see if the declaration is an iterator.
            if(declaration.getExpression() instanceof Declaration) {
              Declaration declarationExpression = (Declaration)declaration.getExpression();
              Variable v = (Variable)declarationExpression.getAssignment().getLeftHandSide();
             
              //check to see if the declaration is the same as the iterator's name.
              if(StringUtils.equals(iteratorName, v.getName())) {
                LOG.debug("Identified Likely Iterator: "+v.getName());
               
                //get the ".next()" statement, which should be the first child.
                AbstractIntermediate firstChild = igc.getTrueTarget(line);
               
                //see if this is a statement, if the statement is an assignment...
                //then check the right side to see if it is an invocation.. and the invocation has the method name "next"...
                if(firstChild instanceof StatementIntermediate) {
                  StatementIntermediate nextStatement = (StatementIntermediate)firstChild;
                  if(nextStatement.getExpression() instanceof Declaration) {
                    //the statement is indeed a declaration.
                    Declaration nextDeclaration = (Declaration)nextStatement.getExpression();
                   
                    if(nextDeclaration.getAssignment().getRightHandSide() instanceof MethodInvocation) {
                      MethodInvocation nextMethodInvocation = (MethodInvocation)nextDeclaration.getAssignment().getRightHandSide();
                     
                      if(StringUtils.equals("next", nextMethodInvocation.getMethodName())) {
                        //YES.
                       
                        //check to see if the next method is on the candidate iterator.
                        if(nextMethodInvocation.getTarget() instanceof Variable) {
                          Variable nextMethodTarget = (Variable)nextMethodInvocation.getTarget();
                         
                         
                          if(StringUtils.equals(iteratorName, nextMethodTarget.getName())) {
                            LOG.info("Definitely an enhanced for loop.");
                           
                            if(declarationExpression.getAssignment().getRightHandSide() instanceof MethodInvocation) {
                              MethodInvocation iteratorInvocation = (MethodInvocation)declarationExpression.getAssignment().getRightHandSide();
                             
                              if(StringUtils.equals("iterator", iteratorInvocation.getMethodName())) {
                                //now, we are pretty certain this is an enhanced for loop...  we can chop up the graph.
                               
                                EnhancedForIntermediate enhancedFor = new EnhancedForIntermediate(line, nextDeclaration.getVariable(), iteratorInvocation.getTarget());
                                igc.getGraph().addVertex(enhancedFor);
                               
                                igc.redirectSuccessors(line, enhancedFor);
                                igc.redirectPredecessors(line, enhancedFor);
                                igc.getGraph().removeVertex(line);
View Full Code Here

Examples of org.eclipse.jdt.core.dom.MethodInvocation

     *
     * @param mname method name
     * @return builder
     */
    public InvocationBuilder createMemberMethodCall(String mname) {
        MethodInvocation methcall = getAST().newMethodInvocation();
        methcall.setName(getAST().newSimpleName(mname));
        return new InvocationBuilder(this, methcall);
    }
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.