// Ignore all static fields.
if (Modifier.isStatic(f.getModifiers()))
continue;
final AnnotationProvider ap = new AnnotationProvider()
{
public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
{
return f.getAnnotation(annotationClass);
}
};
String description = String.format("Calculating injection value for field '%s' (%s)", f.getName(),
ClassFabUtils.toJavaClassName(f.getType()));
tracker.run(description, new Runnable()
{
public void run()
{
final Class<?> fieldType = f.getType();
InjectService is = ap.getAnnotation(InjectService.class);
if (is != null)
{
inject(object, f, locator.getService(is.value(), fieldType));
return;
}
if (ap.getAnnotation(Inject.class) != null)
{
inject(object, f, locator.getObject(fieldType, ap));
return;
}
if (ap.getAnnotation(InjectResource.class) != null)
{
Object value = resources.findResource(fieldType, f.getGenericType());
if (value == null)
throw new RuntimeException(UtilMessages.injectResourceFailure(f.getName(), fieldType));
inject(object, f, value);
return;
}
if (ap.getAnnotation(javax.inject.Inject.class) != null)
{
Named named = ap.getAnnotation(Named.class);
if (named == null)
{
inject(object, f, locator.getObject(fieldType, ap));
}