Class AnnotatedObjectsScanner<T>
java.lang.Object
io.higson.runtime.engine.annotated.scanner.AnnotatedObjectsScanner<T>
- Type Parameters:
T- type of object to instantiate
Annotation scanner util supporting SmartParam* annotations. It not only scans
for annotated objects, but also instantiates them using hints included in
annotation.
Annotation should define:
- value() - to extract unique code of object
- values() - if same object should be returned multiple times under different names
- instances() - if object should be instantiated with specific constructor args
Sortable, it should define
order() method.- Since:
- 0.1.0
- Author:
- Adam Dubiel
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAnnotatedObjects(Class<? extends Annotation> annotationClass, PackageList packagesToScan) Scan for classes annotated with given annotation type, instantiate them using hints from annotation and return a map of those objects.getAnnotatedObjectsWithoutName(Class<? extends Annotation> annotationClass, PackageList packagesToScan) Scan for classes annotated with given annotation and return instances of those objects (instantiated using default constructor).voidsetAnnotatedObjectFactory(AnnotatedObjectFactory annotatedObjectFactory) voidsetReflectionsScanner(ReflectionsScanner reflectionsScanner)
-
Constructor Details
-
AnnotatedObjectsScanner
public AnnotatedObjectsScanner()
-
-
Method Details
-
getAnnotatedObjects
public Map<RepositoryObjectKey,T> getAnnotatedObjects(Class<? extends Annotation> annotationClass, PackageList packagesToScan) Scan for classes annotated with given annotation type, instantiate them using hints from annotation and return a map of those objects.
Might throwAnnotationScannerExceptionif any reflective operation fails.- Parameters:
annotationClass- annotation to look forpackagesToScan- packages to scan- Returns:
- map of objects
- See Also:
-
getAnnotatedObjectsWithoutName
public List<T> getAnnotatedObjectsWithoutName(Class<? extends Annotation> annotationClass, PackageList packagesToScan) Scan for classes annotated with given annotation and return instances of those objects (instantiated using default constructor).- Parameters:
annotationClass- annotation to look forpackagesToScan- packages to scan- Returns:
- list of type T objects
-
setReflectionsScanner
-
setAnnotatedObjectFactory
-