Package org.drools.compiler.lang

Examples of org.drools.compiler.lang.Expander


                             final TemplateModel model ) {
        if ( model == null ) {
            return "";
        } else {
            final String dslr = RuleTemplateModelDRLPersistenceImpl.getInstance().marshal( model );
            final Expander expander = getDSLExpander( path );
            final String drl = expander.expand( dslr );
            return drl;
        }
    }
View Full Code Here


    /**
     * Returns an expander for DSLs (only if there is a DSL configured for this package).
     */
    private Expander getDSLExpander( final Path path ) {
        final Expander expander = new DefaultExpander();
        final List<DSLMappingFile> dsls = getDSLMappingFiles( path );
        for ( DSLMappingFile dsl : dsls ) {
            expander.addDSLMapping( dsl.getMapping() );
        }
        return expander;
    }
View Full Code Here

  
    @Test
    public void testMultiLineTemplates() throws Exception {
        final Reader source = new InputStreamReader( getClass().getResourceAsStream( "rule_with_expander_multiline.dslr" ) );
        final Reader dsl = new InputStreamReader( getClass().getResourceAsStream( "test_dsl_multiline.dsl" ) );
        Expander ex =  new DefaultExpanderResolver(dsl).get("*", null);
        String r = ex.expand(source);
        assertEquals("when Car(color==\"Red\") then doSomething();", r.trim());
    }
View Full Code Here

TOP

Related Classes of org.drools.compiler.lang.Expander

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.