Package org.springframework.expression

Examples of org.springframework.expression.MethodExecutor.execute()


    }

    MethodExecutor executorToUse = this.cachedExecutor;
    if (executorToUse != null) {
      try {
        return executorToUse.execute(
            state.getEvaluationContext(), state.getActiveContextObject().getValue(), arguments);
      }
      catch (AccessException ae) {
        // Two reasons this can occur:
        // 1. the method invoked actually threw a real exception
View Full Code Here


    // either there was no accessor or it no longer existed
    executorToUse = findAccessorForMethod(this.name, getTypes(arguments), state);
    this.cachedExecutor = executorToUse;
    try {
      return executorToUse.execute(
          state.getEvaluationContext(), state.getActiveContextObject().getValue(), arguments);
    } catch (AccessException ae) {
      // Same unwrapping exception handling as above in above catch block
      throwSimpleExceptionIfPossible(state, ae);
      throw new SpelEvaluationException( getStartPosition(), ae, SpelMessage.EXCEPTION_DURING_METHOD_INVOCATION,
View Full Code Here

    public TypedValue getValue() {
      MethodExecutor executorToUse = cachedExecutor;
      if (executorToUse != null) {
        try {
          return executorToUse.execute(evaluationContext, target, arguments);
        }
        catch (AccessException ae) {
          // Two reasons this can occur:
          // 1. the method invoked actually threw a real exception
          // 2. the method invoked was not passed the arguments it expected and has become 'stale'
View Full Code Here

      // either there was no accessor or it no longer existed
      executorToUse = findAccessorForMethod(name, getTypes(arguments), target, evaluationContext);
      cachedExecutor = executorToUse;
      try {
        return executorToUse.execute(evaluationContext, target, arguments);
      } catch (AccessException ae) {
        // Same unwrapping exception handling as above in above catch block
        throwSimpleExceptionIfPossible(state, ae);
        throw new SpelEvaluationException( getStartPosition(), ae, SpelMessage.EXCEPTION_DURING_METHOD_INVOCATION,
            name, state.getActiveContextObject().getValue().getClass().getName(), ae.getMessage());
View Full Code Here

    }

    MethodExecutor executorToUse = this.cachedExecutor;
    if (executorToUse != null) {
      try {
        return executorToUse.execute(
            state.getEvaluationContext(), state.getActiveContextObject().getValue(), arguments);
      }
      catch (AccessException ae) {
        // Two reasons this can occur:
        // 1. the method invoked actually threw a real exception
View Full Code Here

    // either there was no accessor or it no longer existed
    executorToUse = findAccessorForMethod(this.name, getTypes(arguments), state);
    this.cachedExecutor = executorToUse;
    try {
      return executorToUse.execute(
          state.getEvaluationContext(), state.getActiveContextObject().getValue(), arguments);
    } catch (AccessException ae) {
      // Same unwrapping exception handling as above in above catch block
      throwSimpleExceptionIfPossible(state, ae);
      throw new SpelEvaluationException( getStartPosition(), ae, SpelMessage.EXCEPTION_DURING_METHOD_INVOCATION,
View Full Code Here

    }

    MethodExecutor executorToUse = this.cachedExecutor;
    if (executorToUse != null) {
      try {
        return executorToUse.execute(
            state.getEvaluationContext(), state.getActiveContextObject().getValue(), arguments);
      }
      catch (AccessException ae) {
        // this is OK - it may have gone stale due to a class change,
        // let's try to get a new one and call it before giving up
View Full Code Here

    // either there was no accessor or it no longer existed
    executorToUse = findAccessorForMethod(this.name, getTypes(arguments), state);
    this.cachedExecutor = executorToUse;
    try {
      return executorToUse.execute(
          state.getEvaluationContext(), state.getActiveContextObject().getValue(), arguments);
    } catch (AccessException ae) {
      throw new SpelEvaluationException( getStartPosition(), ae, SpelMessage.EXCEPTION_DURING_METHOD_INVOCATION,
          this.name, state.getActiveContextObject().getValue().getClass().getName(), ae.getMessage());
    }
View Full Code Here

    List<TypeDescriptor> argumentTypes = new ArrayList<TypeDescriptor>();
    argumentTypes.add(TypeDescriptor.forObject(arguments));
    ReflectiveMethodResolver resolver = new ReflectiveMethodResolver();
    MethodExecutor executor = resolver.resolve(context, target, "checkCompleteness", argumentTypes);

    Object result = executor.execute(context, target, arguments);
    System.out.println("Result: " + result);
  }

  public static class AlwaysTrueReleaseStrategy {
    public boolean checkCompleteness(List<Foo> messages) {
View Full Code Here

    args.add(TypeDescriptor.forObject(new Integer(42)));

    ConversionPriority1 target = new ConversionPriority1();
    MethodExecutor me = new ReflectiveMethodResolver(true).resolve(emptyEvalContext, target, "getX", args);
    // MethodInvoker chooses getX(int i) when passing Integer
    final int actual = (Integer) me.execute(emptyEvalContext, target, new Integer(42)).getValue();
    // Compiler chooses getX(Number i) when passing Integer
    final int compiler = target.getX(INTEGER);
    // Fails!
    assertEquals(compiler, actual);
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.