/** * Create a component descriptor for the passed component implementation class, hint and component role class. * * @param componentClass the component implementation class * @param hint the hint * @param componentRoleType the component role type * @return the component descriptor with resolved component dependencies */ private ComponentDescriptor createComponentDescriptor(Class<?> componentClass, String hint, Type componentRoleType) { DefaultComponentDescriptor descriptor = new DefaultComponentDescriptor(); descriptor.setRoleType(componentRoleType); descriptor.setImplementation(componentClass); descriptor.setRoleHint(hint); descriptor.setInstantiationStrategy(createComponentInstantiationStrategy(componentClass)); // Set the injected fields. // Note: that we need to find all fields since we can have some inherited fields which are annotated in a // superclass. Since Java doesn't offer a method to return all fields we have to traverse all parent classes // looking for declared fields. for (Field field : ReflectionUtils.getAllFields(componentClass)) { ComponentDependency dependency = createComponentDependency(field); if (dependency != null) { descriptor.addComponentDependency(dependency); } } return descriptor; }