Package org.mvel2.asm

Examples of org.mvel2.asm.FieldVisitor


                BuildUtils.getInternalTypes( classDef.getInterfaces() ) );

    }

    protected void buildLiterals(ClassWriter cw, EnumClassDefinition classDef) {
        FieldVisitor fv;
        for ( EnumLiteralDefinition lit : classDef.getEnumLiterals() ) {
            fv = cw.visitField( ACC_PUBLIC + ACC_FINAL + ACC_STATIC + ACC_ENUM,
                    lit.getName(),
                    BuildUtils.getTypeDescriptor( classDef.getClassName() ),
                    null,
                    null);
            fv.visitEnd();
        }

        {
            fv = cw.visitField( ACC_PRIVATE + ACC_FINAL + ACC_STATIC + ACC_SYNTHETIC,
                    "$VALUES",
                    "[" + BuildUtils.getTypeDescriptor( classDef.getClassName() ),
                    null,
                    null);
            fv.visitEnd();
        }
    }
View Full Code Here


        }
    }


    protected void buildFields(ClassWriter cw, EnumClassDefinition classDef) {
        FieldVisitor fv;
        for ( FieldDefinition fld : classDef.getFieldsDefinitions() ) {
            fv = cw.visitField( ACC_PRIVATE + ACC_FINAL,
                    fld.getName(),
                    BuildUtils.getTypeDescriptor( fld.getTypeName() ),
                    null,
                    null);
            fv.visitEnd();
        }

        {
            fv = cw.visitField(ACC_PRIVATE + ACC_STATIC, "$context", "Lorg/mvel2/ParserContext;", null, null);
            fv.visitEnd();
        }
    }
View Full Code Here

                null);

    }

    private void buildLiterals(ClassWriter cw, EnumClassDefinition classDef) {
        FieldVisitor fv;
        for ( EnumLiteralDefinition lit : classDef.getEnumLiterals() ) {
            fv = cw.visitField( ACC_PUBLIC + ACC_FINAL + ACC_STATIC + ACC_ENUM,
                    lit.getName(),
                    BuildUtils.getTypeDescriptor( classDef.getClassName() ),
                    null,
                    null);
            fv.visitEnd();
        }

        {
            fv = cw.visitField( ACC_PRIVATE + ACC_FINAL + ACC_STATIC + ACC_SYNTHETIC,
                    "$VALUES",
                    "[" + BuildUtils.getTypeDescriptor( classDef.getClassName() ),
                    null,
                    null);
            fv.visitEnd();
        }
    }
View Full Code Here

        }
    }


    private void buildFields(ClassWriter cw, EnumClassDefinition classDef) {
        FieldVisitor fv;
        for ( FieldDefinition fld : classDef.getFieldsDefinitions() ) {
            fv = cw.visitField( ACC_PRIVATE + ACC_FINAL,
                    fld.getName(),
                    BuildUtils.getTypeDescriptor( fld.getTypeName() ),
                    null,
                    null);
            fv.visitEnd();
        }

        {
            fv = cw.visitField(ACC_PRIVATE + ACC_STATIC, "$context", "Lorg/mvel2/ParserContext;", null, null);
            fv.visitEnd();
        }
    }
View Full Code Here

        Class coreKlazz = core.getDefinedClass();
        String coreName = coreKlazz.getName();
        String wrapperName = coreName + "Wrapper";

        ClassWriter cw = new ClassWriter(0);
        FieldVisitor fv;
        MethodVisitor mv;

        cw.visit(V1_5, ACC_PUBLIC + ACC_SUPER,
                BuildUtils.getInternalType(wrapperName),
                BuildUtils.getTypeDescriptor( coreName) +
                        "Lorg/drools/factmodel/traits/CoreWrapper<" + BuildUtils.getTypeDescriptor( coreName ) + ">;",
                BuildUtils.getInternalType( coreName ),
                new String[]{"org/drools/factmodel/traits/CoreWrapper"});

        {
            fv = cw.visitField(ACC_PRIVATE, "core", BuildUtils.getTypeDescriptor( coreName ), null, null);
            fv.visitEnd();
        }
        {
            fv = cw.visitField(ACC_PRIVATE, TraitableBean.MAP_FIELD_NAME, "Ljava/util/Map;", "Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;", null);
            fv.visitEnd();
        }
        {
            fv = cw.visitField(ACC_PRIVATE, TraitableBean.TRAITSET_FIELD_NAME, "Ljava/util/Map;", "Ljava/util/Map<Ljava/lang/String;Lorg/drools/factmodel/traits/Thing;>;", null);
            fv.visitEnd();
        }

        {
            mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
            mv.visitCode();
View Full Code Here

        parserContext.setSourceFile( name );

        String[] varNames = parserContext.getIndexedVarNames();
       
        ExecutableStatement stmt = (ExecutableStatement) compile( expression,
                                                                  runtimeData.getRootClassLoader(),
                                                                  parserContext,
                                                                  languageLevel );
       
        Set<String> localNames = parserContext.getVariables().keySet();
View Full Code Here

        Content content = null;
        if ( taskData.getDocumentAccessType() == AccessType.Inline ) {
            content = em.find( Content.class,
                               taskData.getDocumentContentId() );
        }
        ExpressionCompiler compiler = new ExpressionCompiler( new String( content.getContent() ) );
        Serializable expr = compiler.compile();
        Object object = MVEL.executeExpression( expr );
       
        Map<String, Object> vars = new HashMap<String, Object>();
        vars.put( docVar, object );
        // for now will have to assume the recipient is a User, we need to figure out if Groups have an alias
View Full Code Here

        Map<String, Object> doc = null;
        if ( taskData != null ) {
            Content content = em.find( Content.class,
                                       taskData.getDocumentContentId() );
            if ( content != null ) {
                ExpressionCompiler compiler = new ExpressionCompiler( new String( content.getContent() ) );
                doc = (Map<String, Object>) MVEL.executeExpression( compiler.compile() );
            } else {
                doc = Collections.emptyMap();
            }
        }
View Full Code Here

                        if (actionString == null) {
                            errors.add(new ProcessValidationErrorImpl(process,
                                "Action node '" + node.getName() + "' [" + node.getId() + "] has empty action."));
                        } else if( "mvel".equals( droolsAction.getDialect() ) ) {
                            try {
                                ExpressionCompiler compiler = new ExpressionCompiler(actionString);
                                compiler.setVerifying(true);
                                ParserContext parserContext = new ParserContext();
                                //parserContext.setStrictTypeEnforcement(true);
                                compiler.compile(parserContext);
                                List<ErrorDetail> mvelErrors = parserContext.getErrorList();
                                if (mvelErrors != null) {
                                    for (Iterator<ErrorDetail> iterator = mvelErrors.iterator(); iterator.hasNext(); ) {
                                        ErrorDetail error = iterator.next();
                                        errors.add(new ProcessValidationErrorImpl(process,
View Full Code Here

    }
    return sb.toString();
  }

  public Object eval(String str, Map<String, Object> vars) {
    ExpressionCompiler compiler = new ExpressionCompiler(str.trim());

    ParserContext context = new ParserContext();
    context.addPackageImport("org.drools.task");
    context.addPackageImport("org.drools.task.service");
    context.addPackageImport("org.drools.task.query");
    context.addPackageImport("java.util");

    vars.put("now", new Date());
    return MVEL.executeExpression(compiler.compile(context), vars);
  }
View Full Code Here

TOP

Related Classes of org.mvel2.asm.FieldVisitor

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.