import java.util.Map;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
+import org.opendaylight.mdsal.binding.api.BindingService;
import org.osgi.framework.ServiceReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@NonNullByDefault
final class Dict extends Dictionary<String, Object> {
private static final Logger LOG = LoggerFactory.getLogger(Dict.class);
- private static final Dict EMPTY = new Dict(ImmutableMap.of());
private final Map<String, Object> map;
this.map = ImmutableMap.copyOf(map);
}
- static Dict fromReference(final ServiceReference<?> ref) {
+ static Dict fromReference(final ServiceReference<?> ref, final BindingService service) {
final String[] keys = ref.getPropertyKeys();
- if (keys.length == 0) {
- return EMPTY;
- }
-
- final Map<String, Object> props = Maps.newHashMapWithExpectedSize(keys.length);
+ final Map<String, Object> props = Maps.newHashMapWithExpectedSize(keys.length + 1);
for (String key : keys) {
// Ignore properties with our prefix: we are not exporting those
if (!key.startsWith(ServiceProperties.PREFIX)) {
}
}
+ props.put(AbstractAdaptedService.DELEGATE, service);
return new Dict(props);
}