Annotation Type ConfigType


  • @Repeatable(ConfigTypes.class)
    @Retention(RUNTIME)
    public @interface ConfigType
    Defines an instance of an OSGi R7 Component Property Type as a combination of a Class and an array of strings defining property values in the form expected by Component.property(). This provides both runtime retention for OSGi config annotations that do not have RetentionPolicy.RUNTIME, allowing for simple construction through reflection for explicit passing to SCR component constructors and lifecycle methods, as well as repeatability to support defining sequenced, heterogeneous lists of desired types on any single AnnotatedElement.
    See Also:
    Component Property Types
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      Class<?> type
      Required type to construct.
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      Class<?> component
      When pid() is set to Component.NAME, set this attribute to a class whose name should be used instead.
      boolean lenient
      When set to false, throw a ConfigTypeStrictnessViolation on construction if there is not an exact one-to-one mapping between property names specified in property() and the addressable attributes of type().
      String pid
      Specify a configuration pid to load, which will override matching values specified by property().
      String[] property
      Treat like Component.property().
    • Element Detail

      • type

        Class<?> type
        Required type to construct. This can be an annotation or an interface.
        Returns:
        the type to construct
      • pid

        String pid
        Specify a configuration pid to load, which will override matching values specified by property(). The default value is Component.NAME, which is a special string ("$") that can be used to specify the name of the component() class as a configuration PID.
        Returns:
        a configuration pid, or an empty string
        Default:
        "$"
      • component

        Class<?> component
        When pid() is set to Component.NAME, set this attribute to a class whose name should be used instead. The default value is Void, which has a special significance for this annotation indicating that no configuration should be loaded from ConfigurationAdmin.
        Returns:
        the configurable component class
        Default:
        java.lang.Void.class
      • property

        String[] property
        Treat like Component.property().
        Returns:
        osgi component properties
        Default:
        {}
      • lenient

        boolean lenient
        When set to false, throw a ConfigTypeStrictnessViolation on construction if there is not an exact one-to-one mapping between property names specified in property() and the addressable attributes of type(). Properties loaded from configuration are not considered by the strictness check.
        Returns:
        false to enforce strictness, true to skip the check
        Default:
        false