java.lang.Object
tech.guilhermekaua.spigotboot.core.context.dependency.injector.InjectionPoint

public final class InjectionPoint extends Object
Represents an injection point in the dependency injection system.

An injection point encapsulates information about where a dependency is being injected: the target type, the annotated element (field, parameter, or method), and the qualifier if any. This enables custom injectors to make decisions based on the full context of the injection site.

  • Constructor Details

    • InjectionPoint

      public InjectionPoint(@NotNull @NotNull Type type, @NotNull @NotNull AnnotatedElement annotatedElement, @Nullable @Nullable String qualifier)
      Creates an injection point with the specified type, element, and qualifier.
      Parameters:
      type - the generic type of the dependency, not null
      annotatedElement - the annotated element (field/parameter/method), not null
      qualifier - the qualifier value, or null if none
  • Method Details

    • fromParameter

      @NotNull public static @NotNull InjectionPoint fromParameter(@NotNull @NotNull Parameter parameter)
      Creates an injection point from a constructor or method parameter.
      Parameters:
      parameter - the parameter to create the injection point from, not null
      Returns:
      the injection point representing this parameter
    • fromField

      @NotNull public static @NotNull InjectionPoint fromField(@NotNull @NotNull Field field)
      Creates an injection point from an injected field.
      Parameters:
      field - the field to create the injection point from, not null
      Returns:
      the injection point representing this field
    • fromSetterMethod

      @NotNull public static @NotNull InjectionPoint fromSetterMethod(@NotNull @NotNull Method method)
      Creates an injection point from a setter method.

      The injection point is created from the first (and expected only) parameter of the setter. The qualifier is extracted from the method itself.

      Parameters:
      method - the setter method to create the injection point from, not null
      Returns:
      the injection point representing the setter's parameter
      Throws:
      IllegalArgumentException - if the method has no parameters
    • getRawType

      @Nullable public @Nullable Class<?> getRawType()
      Returns the raw class of this injection point's type.
      Returns:
      the raw class, or null if the type cannot be resolved to a class