Skip to main content
Skip table of contents

Creating an Implementation Factory

If you are familiar with the factory concept, and want to use it in your service model, you can do so using the stereotype Implementation Factory on a class. The setup is like depicted in the class diagram below:

image-20241119-153352.png

The factory class needs to have a static operation called setImplementation(). The input parameter of this operation must be of the interface type (ImplementationInterface), so that it can get all derived classes as an input. An additional optional static operation getImplementation() returns an object of the current implementation class.
The stereotype attribute interfaceReference points to the interface that implements the factory.

This enables the creation of subclasses (ImplementationA and ImplementationB) that can change the way in which an object is created (for example, by redefining which class to instantiate).

As setImplementation() is invoked automatically on service startup, you can also use this to create a implementation that will be executed on service start.
Example: Load some configurations on service start, and pull them during service execution.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.