Package org.mvel2

Examples of org.mvel2.ParserConfiguration.addPackageImport()


    assertEquals("foo", MVEL.executeExpression(s));
  }

  public void testWithAndEnumInPackageImport() {
    ParserConfiguration pconf = new ParserConfiguration();
    pconf.addPackageImport(MyEnum.class.getPackage().getName());

    ParserContext pCtx = new ParserContext(pconf);
    pCtx.setStrongTyping(true);

    pCtx.addInput("thing", Thing.class);
View Full Code Here


    assertEquals("foo", MVEL.executeExpression(s));
  }

  public void testWithAndEnumInPackageImport() {
    ParserConfiguration pconf = new ParserConfiguration();
    pconf.addPackageImport(MyEnum.class.getPackage().getName());

    ParserContext pCtx = new ParserContext(pconf);
    pCtx.setStrongTyping(true);

    pCtx.addInput("thing", Thing.class);
View Full Code Here

            // creating a reusable parser configuration
            ParserConfiguration conf = new ParserConfiguration();
            conf.addAllImports( dialect.getImports() );
            if ( dialect.getPackgeImports() != null && !dialect.getPackgeImports().isEmpty() ) {
                for ( String packageImport : ((Collection<String>) dialect.getPackgeImports().values()) ) {
                    conf.addPackageImport( packageImport );
                }
            }
            conf.setClassLoader( context.getPackageBuilder().getRootClassLoader() );
           
            // first compilation is for verification only
View Full Code Here

            NodeTestCase testCase = (NodeTestCase) context.get( "TestCase" );
            ParserConfiguration conf = new ParserConfiguration();
            for( String imp : testCase.getImports() ) {
                if( imp.endsWith( ".*" ) ) {
                    conf.addPackageImport( imp.substring( 0, imp.lastIndexOf( '.' ) ) );
                } else {
                    try {
                        conf.addImport( imp.substring( imp.lastIndexOf( "." )+1 ), reteTesterHelper.getTypeResolver().resolveType( imp ) );
                    } catch ( ClassNotFoundException e ) {
                        throw new IllegalArgumentException( "Unable to resolve import: "+imp);
View Full Code Here

            // creating a reusable parser configuration
            ParserConfiguration conf = new ParserConfiguration();
            conf.addAllImports( dialect.getImports() );
            if ( dialect.getPackgeImports() != null && !dialect.getPackgeImports().isEmpty() ) {
                for ( String packageImport : ((Collection<String>) dialect.getPackgeImports().values()) ) {
                    conf.addPackageImport( packageImport );
                }
            }
            conf.setClassLoader( context.getPackageBuilder().getRootClassLoader() );
           
            // first compilation is for verification only
View Full Code Here

            NodeTestCase testCase = (NodeTestCase) context.get( "TestCase" );
            ParserConfiguration conf = new ParserConfiguration();
            for( String imp : testCase.getImports() ) {
                if( imp.endsWith( ".*" ) ) {
                    conf.addPackageImport( imp.substring( 0, imp.lastIndexOf( '.' ) ) );
                } else {
                    try {
                        conf.addImport( imp.substring( imp.lastIndexOf( "." )+1 ), reteTesterHelper.getTypeResolver().resolveType( imp ) );
                    } catch ( ClassNotFoundException e ) {
                        throw new IllegalArgumentException( "Unable to resolve import: "+imp);
View Full Code Here

  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());
View Full Code Here

  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

    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

    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
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.