Annotation Type ServiceCapability


  • @Retention(CLASS)
    @Target({TYPE,PACKAGE})
    @Repeatable(ServiceCapabilities.class)
    @Capability(namespace="osgi.service",
                attribute={"objectClass:List<String>=\"${uniq;${#value}}\"","uses:=\"${if;${size;${#uses}};${#uses};${uniq;${replace;${#value};(.*)\\.[^.]+;$1}}}\"","${sjoin;\\;;${#attribute}}"})
    public @interface ServiceCapability
    Adds a ProvideCapability for a service. This is useful to the resolver, when a service is registered manually. It can annotate a class or a package. If it annotates a class without specifying a value, the class will be named as the registered service. Uses constraints will be calculated automatically.
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      java.lang.String[] attribute
      A list of attribute or directive names and values.
      java.lang.Class<?>[] uses
      A list of classes whose packages are inspected to calculate the uses directive for this capability.
      java.lang.Class<?> value
      The service type.
    • Element Detail

      • value

        java.lang.Class<?> value
        The service type.
        Returns:
        the service type
        Default:
        java.lang.annotation.Target.class
      • uses

        java.lang.Class<?>[] uses
        A list of classes whose packages are inspected to calculate the uses directive for this capability.

        If not specified, the uses directive is omitted from the capability clause.

        Default:
        {}
      • attribute

        java.lang.String[] attribute
        A list of attribute or directive names and values.

        Each string should be specified in the form:

        • "name=value" for attributes.
        • "name:type=value" for typed attributes.
        • "name:=value" for directives.
        These are added, separated by semicolons, to the osgi.serviceloader capability. Non-standard osgi.serviceloader attributes will be included as service properties to the published service.
        Default:
        {}