use of org.eclipse.e4.core.di.IBinding in project eclipse.platform.runtime by eclipse.
the class Binding method named.
@Override
public IBinding named(String name) {
Binding binding = new Binding(this);
binding.qualifierName = name;
injector.addBinding(binding);
return binding;
}
use of org.eclipse.e4.core.di.IBinding in project eclipse.platform.runtime by eclipse.
the class InjectorImpl method addBinding.
@Override
public IBinding addBinding(IBinding binding) {
Binding internalBinding = (Binding) binding;
Class<?> clazz = internalBinding.getDescribedClass();
synchronized (bindings) {
if (bindings.containsKey(clazz)) {
Set<Binding> collection = bindings.get(clazz);
String desiredQualifierName = internalBinding.getQualifierName();
for (Iterator<Binding> i = collection.iterator(); i.hasNext(); ) {
Binding collectionBinding = i.next();
if (eq(collectionBinding.getQualifierName(), desiredQualifierName)) {
i.remove();
break;
}
}
collection.add(internalBinding);
} else {
Set<Binding> collection = new HashSet<>(1);
collection.add(internalBinding);
bindings.put(clazz, collection);
}
}
return binding;
}
use of org.eclipse.e4.core.di.IBinding in project eclipse.platform.runtime by eclipse.
the class Binding method implementedBy.
@Override
public IBinding implementedBy(Class<?> implClazz) {
Binding binding = new Binding(this);
binding.implementationClazz = implClazz;
injector.addBinding(binding);
return binding;
}