* Perform injections
*/
public void inject(CamelExtension camelExtension, Object reference,
String beanName) {
for (Method method : consumeMethods) {
Consume annotation = method.getAnnotation(Consume.class);
if (annotation != null) {
String contextName = CamelExtension.getCamelContextName(annotation.context(), startup);
DefaultCamelBeanPostProcessor postProcessor = camelExtension.getPostProcessor(
contextName);
if (postProcessor != null) {
postProcessor.getPostProcessorHelper().consumerInjection(method, reference, beanName);
}
}
}
for (Method method : produceMethods) {
Produce annotation = method.getAnnotation(Produce.class);
if (annotation != null) {
String contextName = CamelExtension.getCamelContextName(annotation.context(), startup);
DefaultCamelBeanPostProcessor postProcessor = camelExtension.getPostProcessor(
contextName);
if (postProcessor != null && postProcessor.getPostProcessorHelper().matchContext(contextName)) {
postProcessor.setterInjection(method, reference, beanName, annotation.uri(), annotation.ref(),
annotation.property());
}
}
}
for (Method method : endpointMethods) {
EndpointInject annotation = method.getAnnotation(EndpointInject.class);
if (annotation != null) {
String contextName = CamelExtension.getCamelContextName(annotation.context(), startup);
DefaultCamelBeanPostProcessor postProcessor = camelExtension.getPostProcessor(
contextName);
if (postProcessor != null && postProcessor.getPostProcessorHelper().matchContext(contextName)) {
postProcessor.setterInjection(method, reference, beanName, annotation.uri(), annotation.ref(),
annotation.property());
}
}
}
for (Field field : produceFields) {
Produce annotation = field.getAnnotation(Produce.class);
if (annotation != null) {
String contextName = CamelExtension.getCamelContextName(annotation.context(), startup);
DefaultCamelBeanPostProcessor postProcessor = camelExtension.getPostProcessor(
contextName);
if (postProcessor != null && postProcessor.getPostProcessorHelper().matchContext(contextName)) {
postProcessor.injectField(field, annotation.uri(), annotation.ref(),
annotation.property(), reference, beanName);
}
}
}
for (Field field : endpointFields) {
EndpointInject annotation = field.getAnnotation(EndpointInject.class);
String contextName = CamelExtension.getCamelContextName(annotation.context(), startup);
DefaultCamelBeanPostProcessor postProcessor = camelExtension.getPostProcessor(
contextName);
if (postProcessor != null && postProcessor.getPostProcessorHelper().matchContext(contextName)) {
postProcessor.injectField(field, annotation.uri(), annotation.ref(),
annotation.property(), reference, beanName);
}
}
}