Class FieldBeanInjection

java.lang.Object
com.bobocode.bring.core.context.impl.FieldBeanInjection

public class FieldBeanInjection extends Object
Responsible for injecting dependencies into fields of a bean using annotations like @Autowired or @Value. Handles field-based dependency injection for annotated fields within a class.
Since:
1.0
Author:
Blyzhnytsia Team
  • Field Details

  • Constructor Details

    • FieldBeanInjection

      public FieldBeanInjection()
  • Method Details

    • injectViaFields

      public void injectViaFields(Class<?> clazz, Object bean)
      Injects dependencies into fields of the provided class instance based on annotations.
      Parameters:
      clazz - The class whose fields are to be injected with dependencies.
      bean - The instance of the class whose fields are being injected.
    • injectDependencyViaField

      private void injectDependencyViaField(Field field, Object bean)
      Injects a dependency into a specific field of the provided bean instance.
      Parameters:
      field - The field to be injected with a dependency.
      bean - The instance of the class whose field is being injected.
    • setFieldDependency

      private static Object setFieldDependency(Field field, Object bean, FieldValueTypeInjector valueType, List<Class<? extends Annotation>> createdBeanAnnotations)
      Sets the value of a field in the provided bean instance with the resolved dependency.
      Parameters:
      field - The field to be set with the resolved dependency.
      bean - The instance of the class whose field is being set.
      valueType - The ValueTypeInjector responsible for setting the field value.
      createdBeanAnnotations - List of created bean annotations used for dependency resolution.
      Returns:
      The resolved dependency object.