Package org.panda_lang.utilities.inject
Interface Resources
public interface Resources
Represents collection of registered binds
-
Method Summary
Modifier and TypeMethodDescription<A extends Annotation>
Bind<A>annotatedWith(Class<A> annotation) Create bind for parameters annotated with the specified annotationdefault <A extends Annotation>
Bind<A>annotatedWithTested(Class<A> annotation) Create bind for parameters annotated with the specified annotation tested by theDependencyInjectionUtils.testAnnotation(Class)methodDuplicate (clone) resourcesAnnotation[][]fetchAnnotations(Executable executable) Fetch annotations assigned to the given executablefetchAnnotations(Parameter parameter) Fetch annotations assigned to the given parameterfork()Create a fork of resources.Get bind for the specified type or annotationCollection<org.panda_lang.utilities.inject.BindHandler<Annotation,Object, ?>> getHandler(Parameter parameter) Get bind for the given parameterBind<?>Create bind for the specified type<A extends Annotation,V, R, E extends Exception>
voidprocessAnnotated(Class<A> annotationType, ThrowingQuadFunction<A, Property, V, Object[], R, E> processor) Process injected object annotated with the given annotation<A extends Annotation,V, R, E extends Exception>
voidprocessAnnotatedType(Class<A> annotationType, Class<V> type, ThrowingQuadFunction<A, Property, V, Object[], R, E> processor) Process injected of the given type and annotated with the given annotation<V,R, E extends Exception>
voidprocessType(Class<V> associatedType, ThrowingTriFunction<Property, V, Object[], R, E> processor) Process injected object of the given type
-
Method Details
-
on
Create bind for the specified type- Parameters:
associatedType- type to bind- Returns:
- the bind based on an associated type
-
annotatedWith
Create bind for parameters annotated with the specified annotation- Type Parameters:
A- type of annotation- Parameters:
annotation- the annotation to bind- Returns:
- the bind based on associated annotation
-
annotatedWithTested
Create bind for parameters annotated with the specified annotation tested by theDependencyInjectionUtils.testAnnotation(Class)method- Type Parameters:
A- type of annotation- Parameters:
annotation- the annotation to bind- Returns:
- the bind based on associated annotation
-
processType
<V,R, void processTypeE extends Exception> (Class<V> associatedType, ThrowingTriFunction<Property, V, Object[], R, E> processor) Process injected object of the given type- Type Parameters:
V- type of value to processR- return typeE- type of thrown exception- Parameters:
associatedType- type to processprocessor- the processor
-
processAnnotated
<A extends Annotation,V, void processAnnotatedR, E extends Exception> (Class<A> annotationType, ThrowingQuadFunction<A, Property, V, Object[], R, E> processor) Process injected object annotated with the given annotation- Type Parameters:
A- type of annotation to processV- type of the injected valueR- return typeE- type of thrown exception- Parameters:
annotationType- the annotation to handleprocessor- the processor
-
processAnnotatedType
<A extends Annotation,V, void processAnnotatedTypeR, E extends Exception> (Class<A> annotationType, Class<V> type, ThrowingQuadFunction<A, Property, V, Object[], R, E> processor) Process injected of the given type and annotated with the given annotation- Type Parameters:
A- type of annotation to processV- type of the injected valueR- return typeE- type of thrown exception- Parameters:
annotationType- the annotation to handletype- the type to handleprocessor- the processor
-
fetchAnnotations
Fetch annotations assigned to the given parameter- Parameters:
parameter- the parameter to process- Returns:
- annotations assigned to the executable parameters
-
fetchAnnotations
Fetch annotations assigned to the given executable- Parameters:
executable- the executable to process- Returns:
- annotations assigned to the executable parameters
-
getHandler
Collection<org.panda_lang.utilities.inject.BindHandler<Annotation,Object, getHandler?>> (Parameter parameter) Get bind for the given parameter- Parameters:
parameter- the parameter to get bind for- Returns:
- the associated bind
-
getBind
Get bind for the specified type or annotation- Parameters:
requestedType- the associated class with bind to search for- Returns:
- the wrapped bind
-
fork
Resources fork()Create a fork of resources. The current resources will be used as a parent of a new instance.- Returns:
- a forked instance of resources
-
duplicate
Resources duplicate()Duplicate (clone) resources- Returns:
- a duplicated instance of resources
-