Annotation Interface Setup
Setup methods are called during construction of the configuration to add further initialisation logic. They shouldn't return a value (if they do, the return value will be discarded). They may take extension points as arguments, which will be resolved from all available extension points of all features in the configuration.
During the execution of setup methods, provisions are not available yet, as the corresponding features may not have been initialized yet. Configuration parameters, however, are available in setup methods.
Setup methods are not suitable to perform any post-construction
actions like application startup. Use a separate start()
method or similar in the configuration instead. The base library
provides a small framework for startup/shutdown for more complex
cases.
Important: Extension points must be used exclusively in setup methods. Unfortunately, there's no way for Meld to protect extension points from escaping the setup method (e.g. by assigning them to a field), it's the programmers responsibility to not do this.
Thread-safety: All mounted features and the
configuration implementation itself will be assigned to a final field and
all setup methods will be called from the constructor. Therefore, all
actions in constructors and setup methods happen-before the
build() method exits, as long as no objects escape the object
tree under construction
(JLS
17.5).
- See Also: