// Process every field
for (final Field field : fields) {
// Try to get inject annotation. New: also turn on extended accessibility, so
// elements don't have to be public anymore.
field.setAccessible(true);
final InjectPlugin ipannotation = field.getAnnotation(InjectPlugin.class);
// If there is one ..
if (ipannotation != null) {
// Obtain capabilities
final String[] capabilities = ipannotation.requiredCapabilities();
// Handle the plugin-parameter part
// In the default case do an auto-detection ...
final Class<? extends Plugin> typeOfField = (Class<? extends Plugin>) field.getType();
this.logger.fine("Injecting plugin by autodetection (" + typeOfField.getName() + ") into " + plugin.getClass().getName());
field.set(plugin, getEntityForType(typeOfField, capabilities));
}
}
// And setter methods as well (aka Scala hack)
for (Method method : methods) {
// Try to get inject annotation. New: also turn on extended accessibility, so
// elements don't have to be public anymore.
method.setAccessible(true);
final InjectPlugin ipannotation = method.getAnnotation(InjectPlugin.class);
if (ipannotation != null) {
// Obtain capabilities
final String[] capabilities = ipannotation.requiredCapabilities();
// Handle the plugin-parameter part
// In the default case do an auto-detection ...
final Class<? extends Plugin> typeOfMethod = (Class<? extends Plugin>) method.getParameterTypes()[0];