Expansion Context

Each expander runs on a specific element. E.g. the BeanExpander for the taskBean is supplied with a composite of the target TaskElement which contains the information of the taskElement required to create the artefact.

A simplified example for a template:

package <taskElement.packageName>;

public interface <taskElement.className>Bean {


In addition to this information the expander often requires information on the context of this element. in the case of the bean, the bean implements the local or remote interface depending on the settings on the application instance:

package <taskElement.packageName>;

public interface <taskElement.className>Bean implements


In order to get this information to the expander, it is not enough to have an constructor like:

public BeanExpander(TaskElementComposite taskElementComposite) {}

Alternatively, the following variant would get out of hand quickly:

public BeanExpander(TaskElementComposite taskElementComposite, ComponentComposite componentComposite, ApplicationComposite applicationComposite) {}

The solution to this problem is to create an object that contains all of these composites in a layered structure:

task element expansion context

Which reduces the constructor to:

public BeanExpander(TaskExpansionContext taskExpansionContext) {}