Interface Injector<I extends Injector<I,B>, B extends InjectorBuilder<B,I>>
- Type Parameters:
I- This typeB- The associatedInjectorBuildertype
- All Known Implementing Classes:
ReflectionInjector
public interface Injector<I extends Injector<I,B>, B extends InjectorBuilder<B,I>>
An injector capable of injecting fields, methods, and constructors
-
Method Summary
Modifier and TypeMethodDescription<T> TCreates a new instance of the given class by attempting to inject into a constructordefault <T> TcreateAndInject(Class<T> cls) Creates a new instance of the given class by attempting to inject into a constructor, then injects the instance's fields and methodsvoidAttempts to inject the appropriate fields, and call the appropriate injection methods, on the given objectvoidinjectStatic(Class<?> cls) Attempts to inject the appropriate static fields, and call the appropriate static injection methods, on the given objectCopies thisInjector's settings into a builder of the appropriate type, and returns it.
-
Method Details
-
toBuilder
-
createAndInject
Creates a new instance of the given class by attempting to inject into a constructor, then injects the instance's fields and methods- Type Parameters:
T- The type of the class- Parameters:
cls- The cls to instantiate- Returns:
- A new instance of
T
-
create
Creates a new instance of the given class by attempting to inject into a constructor- Type Parameters:
T- The type of the class- Parameters:
cls- The class to instantiate- Returns:
- A new instance of
T
-
inject
Attempts to inject the appropriate fields, and call the appropriate injection methods, on the given object- Parameters:
object- The object to inject into
-
injectStatic
Attempts to inject the appropriate static fields, and call the appropriate static injection methods, on the given object- Parameters:
cls- The class to inject into
-