Let's say we want to do the common HelloWorld example, but with a more domain-oriented setting. We have a Speach interface that does the talking;

Qi4j is an implementation of Composite Oriented Programming. So, we need a Composite for our domain model. We are creating a PoliticianComposite, that among other things can talk, via the Speaker interface. We create a PoliticianComposite that extends from the Composite interface and our Speaker interface. But we also need an implementation for Speaker, which we also declare in our Composite, the @Mixins( SpeakerMixin.class ).

And of course, the simple implementation of the Speaker interface. In this case, return a String with the content "Hello, World!".

So far so good. We now need to make this into something that can run. This can be done like this;

The SingletonAssembler creates the simplest Qi4j Runtime. It provides access to a CompositeBuilderFactory, from which we can instantiate our PoliticianComposite as a Speaker.