Package org.springframework.expression.spel

Examples of org.springframework.expression.spel.CodeFlow


    mv = cw.visitMethod(ACC_PUBLIC, "getValue",
        "(Ljava/lang/Object;Lorg/springframework/expression/EvaluationContext;)Ljava/lang/Object;", null,
        new String[ ]{"org/springframework/expression/EvaluationException"});
    mv.visitCode();

    CodeFlow cf = new CodeFlow(clazzName, cw);

    // Ask the expression AST to generate the body of the method
    try {
      expressionToCompile.generateCode(mv, cf);
    }
    catch (IllegalStateException ex) {
      if (logger.isDebugEnabled()) {
        logger.debug(expressionToCompile.getClass().getSimpleName() +
            ".generateCode opted out of compilation: " + ex.getMessage());
      }
      return null;
    }

    CodeFlow.insertBoxIfNecessary(mv, cf.lastDescriptor());
    if ("V".equals(cf.lastDescriptor())) {
      mv.visitInsn(ACONST_NULL);
    }
    mv.visitInsn(ARETURN);

    mv.visitMaxs(0, 0)// not supplied due to COMPUTE_MAXS
    mv.visitEnd();
    cw.visitEnd();
   
    cf.finish();
   
    byte[] data = cw.toByteArray();
    // TODO need to make this conditionally occur based on a debug flag
    // dump(expressionToCompile.toStringAST(), clazzName, data);
    return (Class<? extends CompiledExpression>) this.ccl.defineClass(clazzName.replaceAll("/", "."), data);
View Full Code Here

TOP

Related Classes of org.springframework.expression.spel.CodeFlow

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.