private Expression createParameterUnmarshalExpressionForAnnotation( Class<?> clazz, Method method, Class<?> parameterType, Annotation annotation) { if (annotation instanceof AttachmentObjects) { return ExpressionBuilder.attachmentObjectsExpression(); } else if (annotation instanceof Attachments) { return ExpressionBuilder.attachmentsExpression(); } else if (annotation instanceof Property) { Property propertyAnnotation = (Property) annotation; return ExpressionBuilder.exchangePropertyExpression(propertyAnnotation.value()); } else if (annotation instanceof ExchangeProperty) { ExchangeProperty propertyAnnotation = (ExchangeProperty) annotation; return ExpressionBuilder.exchangePropertyExpression(propertyAnnotation.value()); } else if (annotation instanceof Properties) { return ExpressionBuilder.propertiesExpression(); } else if (annotation instanceof Header) { Header headerAnnotation = (Header) annotation; return ExpressionBuilder.headerExpression(headerAnnotation.value()); } else if (annotation instanceof Headers) { return ExpressionBuilder.headersExpression(); } else if (annotation instanceof OutHeaders) { return ExpressionBuilder.outHeadersExpression(); } else if (annotation instanceof ExchangeException) { return ExpressionBuilder.exchangeExceptionExpression( CastUtils.cast(parameterType, Exception.class)); } else { LanguageAnnotation languageAnnotation = annotation.annotationType().getAnnotation(LanguageAnnotation.class); if (languageAnnotation != null) { Class<?> type = languageAnnotation.factory(); Object object = camelContext.getInjector().newInstance(type); if (object instanceof AnnotationExpressionFactory) { AnnotationExpressionFactory expressionFactory = (AnnotationExpressionFactory) object; return expressionFactory.createExpression( camelContext, annotation, languageAnnotation, parameterType); } else { LOG.warn( "Ignoring bad annotation: " + languageAnnotation + "on method: " + method + " which declares a factory: " + type.getName() + " which does not implement " + AnnotationExpressionFactory.class.getName()); } } } return null; }
public static Expression header(String headerName) { return ExpressionBuilder.headerExpression(headerName); }