-
Notifications
You must be signed in to change notification settings - Fork 5
Request API
The request API is one of the most important feature of plugins. It allows to build requests which will be computed by the kernel. The kernel will scan the classpath to find the requested resources.
You can create a classpath scan request in a plugin, using the classpathScanRequestBuilder()
method inherited from AbstractPlugin
.
Type | Description |
---|---|
specifiation |
Requests classes based on specification. {Kametic Specification} is used as implementation of the specification pattern. |
annotationType |
Requests classes annotated by a given annotation. |
annotationRegex |
Requests classes annotated by an annotation matching the regex. |
subtypeOf |
Request classes which directly extends or implements a given class. |
descendentTypeOf |
Request all the classes which descend from a given class. |
subTypeOfRegex |
Request classes which directly extends or implements a class matching the regex. |
typeOfRegex |
Request classes which have a name matching the regex. |
resourcesRegex |
Request resources whose path match the regex. For instance, all the files under |
Then register the requests as follows.
@Override
public Collection<ClasspathScanRequest> classpathScanRequests() {
return classpathScanRequestBuilder()
.subtypeOf(DiagnosticInfoCollector.class)
.annotationType(Install.class).build();
}
The results of the requests will be available in the initContext
of the init()
method.
@Override
public InitState init(InitContext initContext) {
Map<Class<? extends Annotation>, Collection<Class<?>>> scannedClassesByAnnotationClass = initContext.scannedClassesByAnnotationClass();
for (Class<?> candidate : scannedClassesByAnnotationClass.get(Install.class)) {
...
}
...
return InitState.INITIALIZED;
}
- Introduction
- ... Motivation
- ... Features
- ... Manifesto
- User manual
- ... Kernel
- ...... Kernel Life Cycle
- ...... Kernel Configuration
- ... Plugin
- ...... Plugin Life cycle
- ...... Request API
- ...... Native Module
- ...... Dependencies
- ... Tests
- ...... Integration Tests
- Advanced topics
- ... Design Best Practices
- ... Multi-Round Plugin
- ... Kernel param aliases
- ... SPI
- ...... DI Provider
- ...... Concern
- ...... Extension
- Definitions
- ... Framework
- ... Entreprise Stack
- ... API
- ... SPI
- ... Library
- ... Inversion of Control
- ... Dependency Injection
- Concepts
- ... UnitModule
- ... GlobalModule
- ... ObjectGraph