Creator - examples

Printer-friendly versionPrinter-friendly version
How to use the Creator framework

Here you can find some simplified examples, how to use the Creator framework.


Using the Creator framework to create objects context dependent is normally as simple as to type something like


Foobar foobar = new FoobarCreator().create();

(using a default context)


Foobar foobar = new FoobarCreator(foo).create();

(using parameters and a default context)


Foobar foobar = new FoobarCreator().create(localContext);

(using a per-creation context)


FoobarCreator foobarCreator = new FoobarCreator().setContext(localContext);
Foobar foobar = foobarCreator.create();

(using a per-creator context)


But before we can create objects that easily and with any context we like, we have to implement some creational infrastructure that is specialized for our system and domain.

We will do that on the following pages...