Package org.mvel2.asm.tree

Examples of org.mvel2.asm.tree.InnerClassNode


 
  public VariableResolver getVariableResolver(String name) {
    Object value = ((VariableScopeInstance)
      nodeInstance.resolveContextInstance(
          VariableScope.VARIABLE_SCOPE, name)).getVariable(name);
    return new SimpleValueResolver(value);
  }
View Full Code Here


    return variableScope.getVariable(name) != null;
  }
 
  public VariableResolver getVariableResolver(String name) {
    Object value = variableScope.getVariable(name);
    return new SimpleValueResolver(value);
  }
View Full Code Here

    }

    @Override
    public void load(String name, String view) {
        // compile the template
        CompiledTemplate compiled = TemplateCompiler.compileTemplate(view);
        registry.addNamedTemplate(name, compiled);
    }
View Full Code Here

    protected static String JAVA_RULE_MVEL             = "javaRule.mvel";
    protected static String JAVA_INVOKERS_MVEL         = "javaInvokers.mvel";

    public static void setConsequenceTemplate( String name ) {
        JAVA_RULE_MVEL = name;
        RULE_REGISTRY = new SimpleTemplateRegistry();
    }
View Full Code Here

        RULE_REGISTRY = new SimpleTemplateRegistry();
    }

    public static void setInvokerTemplate( String name ) {
        JAVA_INVOKERS_MVEL = name;
        INVOKER_REGISTRY = new SimpleTemplateRegistry();
    }
View Full Code Here

                                 final ProcessBuildContext context,
                                 final String className,
                                 final Map vars,
                                 final Object invokerLookup,
                                 final BaseDescr descrLookup) {
        TemplateRegistry registry = getRuleTemplateRegistry();

        context.getMethods().add(
                TemplateRuntime.execute(registry.getNamedTemplate(ruleTemplate), null, new MapVariableResolverFactory(vars), registry)
        );

        registry = getInvokerTemplateRegistry();
        final String invokerClassName = context.getPkg().getName() + "." + context.getProcessDescr().getClassName() + StringUtils.ucFirst(className) + "Invoker";

        context.getInvokers().put(invokerClassName,
                TemplateRuntime.execute(registry.getNamedTemplate(invokerTemplate), null, new MapVariableResolverFactory(vars), registry)
        );

        context.getInvokerLookups().put(invokerClassName,
                invokerLookup);
        context.getDescrLookups().put(invokerClassName,
View Full Code Here

        generateMethodTemplate(ruleTemplate, context, vars);
        generateInvokerTemplate(invokerTemplate, context, className, vars, invokerLookup, descrLookup);
    }

    public static void generateMethodTemplate(final String ruleTemplate, final RuleBuildContext context, final Map vars) {
        TemplateRegistry registry = getRuleTemplateRegistry(context.getPackageBuilder().getRootClassLoader());

        context.addMethod((String) TemplateRuntime.execute( registry.getNamedTemplate(ruleTemplate),
                                                            null,
                                                            new MapVariableResolverFactory(vars),
                                                            registry) );
    }
View Full Code Here

                                               final RuleBuildContext context,
                                               final String className,
                                               final Map vars,
                                               final Object invokerLookup,
                                               final BaseDescr descrLookup) {
        TemplateRegistry registry = getInvokerTemplateRegistry(context.getPackageBuilder().getRootClassLoader());
        final String invokerClassName = context.getPkg().getName() + "." + context.getRuleDescr().getClassName() + StringUtils.ucFirst( className ) + "Invoker";

        context.getInvokers().put( invokerClassName,
                                   (String) TemplateRuntime.execute( registry.getNamedTemplate( invokerTemplate ),
                                                                     null,
                                                                     new MapVariableResolverFactory( vars ),
                                                                     registry ) );

        context.getInvokerLookups().put( invokerClassName,
View Full Code Here

        String[] allVars = new String[varNames.length + locals.length];

        System.arraycopy(varNames, 0, allVars, 0, varNames.length);
        System.arraycopy(locals, 0, allVars, varNames.length, locals.length);       
       
        this.varModel = new SimpleVariableSpaceModel(allVars);
        this.allVarsLength = allVars.length;
       
        return stmt;
    }
View Full Code Here

        println(".debug ", cn.sourceDebug == null
                ? null
                : '"' + cn.sourceDebug + '"');

        for (int i = 0; i < cn.innerClasses.size(); ++i) {
            InnerClassNode in = cn.innerClasses.get(i);
            pw.print(".inner class");
            pw.print(access(in.access));
            if (in.innerName != null) {
                pw.print(' ');
                pw.print(in.innerName);
            }
            if (in.name != null) {
                pw.print(" inner ");
                pw.print(in.name);
            }
            if (in.outerName != null) {
                pw.print(" outer ");
                pw.print(in.outerName);
            }
            pw.println();
        }

        for (int i = 0; i < cn.fields.size(); ++i) {
            FieldNode fn = cn.fields.get(i);
            boolean annotations = false;
            if (fn.visibleAnnotations != null
                    && fn.visibleAnnotations.size() > 0)
            {
                annotations = true;
            }
            if (fn.invisibleAnnotations != null
                    && fn.invisibleAnnotations.size() > 0)
            {
                annotations = true;
            }
            boolean deprecated = (fn.access & Opcodes.ACC_DEPRECATED) != 0;
            pw.print("\n.field");
            pw.print(access(fn.access));
            pw.print(" '");
            pw.print(fn.name);
            pw.print("' ");
            pw.print(fn.desc);
            if (fn.signature != null && (!deprecated && !annotations)) {
                pw.print(" signature \"");
                pw.print(fn.signature);
                pw.print("\"");
            }
            if (fn.value instanceof String) {
                StringBuffer buf = new StringBuffer();
                AbstractVisitor.appendString(buf, (String) fn.value);
                pw.print(" = ");
                pw.print(buf.toString());
            } else if (fn.value != null) {
                pw.print(" = ");
                print(fn.value);
                pw.println();
            }
            pw.println();
            if (fn.signature != null && (deprecated || annotations)) {
                pw.print(".signature \"");
                pw.print(fn.signature);
                pw.println("\"");
            }
            if (deprecated) {
                pw.println(".deprecated");
            }
            printAnnotations(fn);
            if (deprecated || annotations) {
                pw.println(".end field");
            }
        }

        for (int i = 0; i < cn.methods.size(); ++i) {
            MethodNode mn = cn.methods.get(i);
            pw.print("\n.method");
            pw.print(access(mn.access));
            pw.print(' ');
            pw.print(mn.name);
            pw.println(mn.desc);
            if (mn.signature != null) {
                pw.print(".signature \"");
                pw.print(mn.signature);
                pw.println("\"");
            }
            if (mn.annotationDefault != null) {
                pw.println(".annotation default");
                printAnnotationValue(mn.annotationDefault);
                pw.println(".end annotation");
            }
            printAnnotations(mn);
            if (mn.visibleParameterAnnotations != null) {
                for (int j = 0; j < mn.visibleParameterAnnotations.length; ++j)
                {
                    List<AnnotationNode> l = mn.visibleParameterAnnotations[j];
                    if (l != null) {
                        for (int k = 0; k < l.size(); ++k) {
                            printAnnotation(l.get(k), 1, j + 1);
                        }
                    }
                }
            }
            if (mn.invisibleParameterAnnotations != null) {
                for (int j = 0; j < mn.invisibleParameterAnnotations.length; ++j)
                {
                    List<AnnotationNode> l = mn.invisibleParameterAnnotations[j];
                    if (l != null) {
                        for (int k = 0; k < l.size(); ++k) {
                            printAnnotation(l.get(k), 2, j + 1);
                        }
                    }
                }
            }
            for (int j = 0; j < mn.exceptions.size(); ++j) {
                println(".throws ", mn.exceptions.get(j));
            }
            if ((mn.access & Opcodes.ACC_DEPRECATED) != 0) {
                pw.println(".deprecated");
            }
            if (mn.instructions.size() > 0) {
                labelNames.clear();
                for (int j = 0; j < mn.tryCatchBlocks.size(); ++j) {
                    TryCatchBlockNode tcb = mn.tryCatchBlocks.get(j);
                    pw.print(".catch ");
                    pw.print(tcb.type);
                    pw.print(" from ");
                    print(tcb.start);
                    pw.print(" to ");
                    print(tcb.end);
                    pw.print(" using ");
                    print(tcb.handler);
                    pw.println();
                }
                for (int j = 0; j < mn.instructions.size(); ++j) {
                    AbstractInsnNode in = mn.instructions.get(j);
                    in.accept(new EmptyVisitor() {

                        @Override
                        public void visitFrame(
                            int type,
                            int local,
View Full Code Here

TOP

Related Classes of org.mvel2.asm.tree.InnerClassNode

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.