Locations of visitors to this page

Assembler

The Assembler interface is useful to prepare code that populates (assembles) the ModuleAssembly with Composites, Objects and Services.

Description

Description goes here...

Declaration

package org.qi4j.bootstrap;

public interface Assembler
{
    void assemble( ModuleAssembly module )
        throws AssemblyException;
}

Example

The following code is a simple (non-operational) example of how to declare and use an Assembler.

ModuleAssembly assembly = layer.newModuleAssembly();
WebAssembler web = new WebAssembler( "webservice" );
assembly.addAssembler( web );

public class WebAssembler
    implements Assembler
{
    private String name;

    public WebAssembler( String name )
    {
        this.name = name;
    }

    public void assemble( ModuleAssembly assembly )
        throws AssemblyException
    {
        assembly.addComposites( RequestComposite.class );
        assembly.addComposites( ResponseComposite.class );
        assembly.addServices( WebServiceComposite.class )
            .visibleIn( Visibility.application )
            .identifiedBy( name );
        assembly.addEntities( WebServiceSettingsEntity.class );
    }
}


Qi4j and the Qi4j logo are trademarks of Richard Öberg, Niclas Hedhman and the members of the Qi4j Core Team. See Qi4j licensing for more information.
Powered by SiteVisionexternal link.