use of org.eclipse.e4.core.di.suppliers.IObjectDescriptor in project eclipse.platform.runtime by eclipse.
the class InjectorImpl method getImplementationClass.
private Class<?> getImplementationClass(Class<?> clazz) {
IObjectDescriptor descriptor = new ObjectDescriptor(clazz, null);
Binding binding = findBinding(descriptor);
if (binding == null)
return getDesiredClass(descriptor.getDesiredType());
return binding.getImplementationClass();
}
use of org.eclipse.e4.core.di.suppliers.IObjectDescriptor in project eclipse.platform.runtime by eclipse.
the class InjectorImpl method findExtendedSupplier.
private ExtendedObjectSupplier findExtendedSupplier(IObjectDescriptor descriptor, PrimaryObjectSupplier objectSupplier) {
Annotation[] qualifiers = descriptor.getQualifiers();
if (qualifiers == null)
return null;
for (Annotation qualifier : qualifiers) {
Class<?> type = qualifier.annotationType();
String key = ((Class<?>) type).getName();
ExtendedObjectSupplier supplier;
try {
// use qualified name to refer to a class that might be missing
supplier = org.eclipse.e4.core.internal.di.osgi.ProviderHelper.findProvider(key, defaultSupplier);
} catch (NoClassDefFoundError e) {
// OSGi framework not present
return null;
}
if (supplier != null)
return supplier;
}
return null;
}
use of org.eclipse.e4.core.di.suppliers.IObjectDescriptor in project eclipse.platform.runtime by eclipse.
the class ClassRequestor method calcDependentObjects.
@Override
public IObjectDescriptor[] calcDependentObjects() {
if (pseudoVariableDescriptor == null) {
Field field = null;
try {
// $NON-NLS-1$
field = ClassRequestor.class.getField("pseudoVariable");
} catch (SecurityException e) {
// tested - not going to happen
e.printStackTrace();
return null;
} catch (NoSuchFieldException e) {
// tested - not going to happen
e.printStackTrace();
return null;
}
pseudoVariableDescriptor = new IObjectDescriptor[] { new ObjectDescriptor(field.getGenericType(), field.getAnnotations()) };
}
return pseudoVariableDescriptor;
}
Aggregations