Search in sources :

Example 1 with ReferenceCardinality

use of org.osgi.service.component.annotations.ReferenceCardinality in project bnd by bndtools.

the class DSAnnotations method addServiceRequirement.

private void addServiceRequirement(ReferenceDef ref, MergedRequirement requires) {
    String objectClass = ref.service;
    ReferenceCardinality cardinality = ref.cardinality;
    boolean optional = cardinality == ReferenceCardinality.OPTIONAL || cardinality == ReferenceCardinality.MULTIPLE;
    boolean multiple = cardinality == ReferenceCardinality.MULTIPLE || cardinality == ReferenceCardinality.AT_LEAST_ONE;
    String filter = "(objectClass=" + objectClass + ")";
    requires.put(filter, "active", optional, multiple);
}
Also used : ReferenceCardinality(org.osgi.service.component.annotations.ReferenceCardinality)

Aggregations

ReferenceCardinality (org.osgi.service.component.annotations.ReferenceCardinality)1