Package org.drools.lang.descr

Examples of org.drools.lang.descr.ImportDescr


    public final void statement() throws RecognitionException {
        AttributeDescr a = null;

        FunctionImportDescr fi = null;

        ImportDescr is = null;

        DescrBuilderTree.global_return gl = null;

        DescrBuilderTree.function_return fn = null;
View Full Code Here



    // $ANTLR start "import_statement"
    // src/main/resources/org/drools/lang/DescrBuilderTree.g:87:1: import_statement returns [ImportDescr importDescr] : ^(importStart= VK_IMPORT importId= import_name ) ;
    public final ImportDescr import_statement() throws RecognitionException {
        ImportDescr importDescr = null;

        DroolsTree importStart=null;
        DescrBuilderTree.import_name_return importId = null;

View Full Code Here

        parse( source ).compilation_unit();
        assertEquals( "foo",
                      this.parser.getPackageDescr().getName() );
        assertEquals( 2,
                      this.parser.getPackageDescr().getImports().size() );
        ImportDescr impdescr = (ImportDescr) this.parser.getPackageDescr().getImports().get( 0 );
        assertEquals( "com.foo.Bar",
                      impdescr.getTarget() );
        assertEquals( source.indexOf( "import " + impdescr.getTarget() ),
                      impdescr.getStartCharacter() );
        assertEquals( source.indexOf( "import " + impdescr.getTarget() ) + ("import " + impdescr.getTarget()).length() - 1,
                      impdescr.getEndCharacter() );

        impdescr = (ImportDescr) this.parser.getPackageDescr().getImports().get( 1 );
        assertEquals( "com.foo.Baz",
                      impdescr.getTarget() );
        assertEquals( source.indexOf( "import " + impdescr.getTarget() ),
                      impdescr.getStartCharacter() );
        assertEquals( source.indexOf( "import " + impdescr.getTarget() ) + ("import " + impdescr.getTarget()).length() - 1,
                      impdescr.getEndCharacter() );

        assertFalse( this.parser.hasErrors() );
    }
View Full Code Here

        loader.addExternalImportDescrProvider( new SuggestionCompletionLoader.ExternalImportDescrProvider() {

            public Set<ImportDescr> getImportDescrs() {
                return new HashSet<ImportDescr>() {
                    {
                        add( new ImportDescr( "java.util.List" ) );
                        add( new ImportDescr( "java.util.Set" ) );
                    }
                };
            }
        } );
        SuggestionCompletionEngine eng = loader.getSuggestionEngine( "package foo \n import org.drools.Person",
View Full Code Here

        loader.addExternalImportDescrProvider( new SuggestionCompletionLoader.ExternalImportDescrProvider() {

            public Set<ImportDescr> getImportDescrs() {
                return new HashSet<ImportDescr>() {
                    {
                        add( new ImportDescr( "java.util.List" ) );
                        add( new ImportDescr( "java.util.Set" ) );
                    }
                };
            }
        } );
        SuggestionCompletionEngine eng = loader.getSuggestionEngine( "package foo \n import org.drools.Person \n declare GenBean \n   id: int \n name : String \n end \n declare GenBean2 \n list: java.util.List \n gb: GenBean \n end",
View Full Code Here

public class ImportDescrBuilderImpl extends BaseDescrBuilderImpl<PackageDescrBuilder, ImportDescr>
    implements
    ImportDescrBuilder {

    protected ImportDescrBuilderImpl(PackageDescrBuilder parent, boolean function) {
        super( parent, function ? new FunctionImportDescr() : new ImportDescr() );
    }
View Full Code Here

        PackageRegistry pkgRegistry = new PackageRegistry( this,
                                                           pkg );

        // add default import for this namespace
        pkgRegistry.addImport( new ImportDescr( packageDescr.getNamespace() + ".*" ) );

        this.pkgRegistryMap.put( packageDescr.getName(),
                                 pkgRegistry );

        return pkgRegistry;
View Full Code Here

            if ( importEntry == null || importEntry.trim().equals( "" ) ) {
                throw new SAXParseException( "<import> cannot be blank",
                                             parser.getLocator() );
            }
            packageDescr.addImport( new ImportDescr( importEntry ) );
        }
       
        NodeList importfunctions = element.getElementsByTagName( "importfunction" );

        for ( int i = 0, length = importfunctions.getLength(); i < length; i++ ) {
View Full Code Here

        }

        this.results = new ArrayList<KnowledgeBuilderResult>();
        this.src = new MemoryResourceReader();
        if ( this.pkg != null ) {
            this.addImport( new ImportDescr( this.pkg.getName() + ".*" ) );
        }
        this.addImport( new ImportDescr( "java.lang.*" ) );
    }
View Full Code Here

    }

    public void postCompileAddFunction(FunctionDescr functionDescr,
                                       TypeResolver typeResolver) {
        final String functionClassName = this.pkg.getName() + "." + StringUtils.ucFirst( functionDescr.getName() );
        ImportDescr importDescr = new ImportDescr(functionClassName + "." + functionDescr.getName());
        importDescr.setResource(functionDescr.getResource());
        importDescr.setNamespace(functionDescr.getNamespace());
        this.packageRegistry.addStaticImport( importDescr );
    }
View Full Code Here

TOP

Related Classes of org.drools.lang.descr.ImportDescr

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.