Modeling Configuration in Annotation Style
To model a managed object that has configuration, implement a method that returns a configuration object, and annotate that method as @TeaGetConfig.
See also Configuration Aspect.
Before you beginThe object is defined in interface style.
- Procedure
- Define a configuration bean that encapsulates all the parameters of the managed object.
For example, the configuration of a radio could include changeable settings (such as the frequency and volume) and unchanging attributes (such as model and serial number).
public class RadioConfig { private long frequency; private int volume; private string model; private string serial; // Constructors. Get and set methods for each field. ... } - Define a method that gets the current configuration, returning it as an instance of your configuration class.
public RadioConfig getConfig() { ... } - Annotate that method as
@TeaGetConfig.
@TeaGetConfig public RadioConfig getConfig() { ... }