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

Prerequisites

The object is defined in interface style.

Procedure

  1. 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.
        ...
    }
  2. Define a method that gets the current configuration, returning it as an instance of your configuration class.
        public RadioConfig getConfig() {
            ...
        }
    
  3. Annotate that method as @TeaGetConfig.
    @TeaGetConfig
        public RadioConfig getConfig() {
            ...
        }