* @param headerName the name of the header the expression will return
* @param type the type to convert to
* @return an expression object which will return the header value
*/
public static <T> Expression headerExpression(final String headerName, final Class<T> type) {
return new ExpressionAdapter() {
public Object evaluate(Exchange exchange) {
Object header = exchange.getIn().getHeader(headerName, type);
if (header == null) {
// fall back on a property
header = exchange.getProperty(headerName, type);