Class InjectionPoint
java.lang.Object
tech.guilhermekaua.spigotboot.core.context.dependency.injector.InjectionPoint
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 Summary
ConstructorsConstructorDescriptionInjectionPoint(@NotNull Type type, @NotNull AnnotatedElement annotatedElement, @Nullable String qualifier) Creates an injection point with the specified type, element, and qualifier. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull InjectionPointCreates an injection point from an injected field.static @NotNull InjectionPointfromParameter(@NotNull Parameter parameter) Creates an injection point from a constructor or method parameter.static @NotNull InjectionPointfromSetterMethod(@NotNull Method method) Creates an injection point from a setter method.@Nullable Class<?>Returns the raw class of this injection point's type.
-
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 nullannotatedElement- the annotated element (field/parameter/method), not nullqualifier- the qualifier value, or null if none
-
-
Method Details
-
fromParameter
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
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
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
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
-