Annotation Interface Config


@SupportedAll @Retention(RUNTIME) @Target(TYPE) public @interface Config
Indicates that an interface describes the configuration of an SMS service.

The methods of the interface annotated with Attribute form the schema of the service, which will be used by SMS to automatically generate REST endpoints for manipulating the service.

All methods MUST be annotated with Attribute, Id, SubConfig or have a default implementation.

The schema created for a particular annotated method is controlled by a TypeAdapter. The adapter for a method is chosen as follows:

  1. If the method has an annotation that implies a TypeAdapter, it is used.
  2. Otherwise, the TypeAdapter is inferred from the return type of the method.

Interfaces annotated with this annotation should be registered with the AnnotatedServiceRegistry. The registry can then be used to obtain concrete implementations of the interface.

Example:


 @Config(scope = GLOBAL)
 interface MyGlobalServiceConfig {
   @Attribute(order = 100)
   String myAttribute();

   @Attribute(order = 300)
   default int myDefaultedAttribute() {
     return 5;
   }

   @Attribute(order = 200)
   @MyType
   CustomType anotherAttribute();
 }
 
Since:
AM 5.5.0
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The types of visibility available for a service.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The scope of the service configuration.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Whether multiple instances are supported for this service.
    boolean
    Whether to create a sub-schema container entry.
    The key for the service description in the i18n bundle.
    boolean
    Whether the config service should be hidden from the config UI.
    The name of the i18n bundle file (without .properties suffix), relative to the root package.
    The name of the service.
    The resource name of the service in the REST endpoints.
    boolean
    Whether this service is enabled for REST.
    A validator to apply to the entire configuration object.
    The version number of the service.
  • Element Details

    • scope

      The scope of the service configuration.
      Returns:
      the scope.
    • name

      String name
      The name of the service. If not provided, the simple name of the annotated interface is used.
      Returns:
      the name.
      Default:
      ""
    • version

      String version
      The version number of the service.
      Returns:
      the version.
      Default:
      "1.0"
    • resourceName

      String resourceName
      The resource name of the service in the REST endpoints. If not provided, the name of the service is used.
      Returns:
      the resource name.
      See Also:
      Default:
      ""
    • collection

      boolean collection
      Whether multiple instances are supported for this service.
      Returns:
      true if the config is for a collection.
      Default:
      false
    • container

      boolean container
      Whether to create a sub-schema container entry.

      Generally this should not be changed from the default.

      Returns:
      true if the sub-schema requires a nested container entry.
      Default:
      true
    • i18nFile

      String i18nFile
      The name of the i18n bundle file (without .properties suffix), relative to the root package.

      If not provided, this will default to the interface name, with the slash-separated package prefix.

      Returns:
      the i18n file name.
      Default:
      ""
    • descriptionKey

      String descriptionKey
      The key for the service description in the i18n bundle.
      Returns:
      the i18n description key.
      Default:
      "serviceDescription"
    • validator

      Class<?> validator
      A validator to apply to the entire configuration object.

      If set, the value must be a class implementing the ServiceConfigValidator interface.

      Returns:
      the validator class.
      Default:
      java.lang.Void.class
    • hiddenFromConfigUi

      boolean hiddenFromConfigUi
      Whether the config service should be hidden from the config UI. Defaults to false.
      Returns:
      true if the service should be hidden.
      Default:
      false
    • restEnabled

      boolean restEnabled
      Whether this service is enabled for REST. Defaults to true.
      Returns:
      whether this service is enabled for REST.
      Default:
      true