// Split ognl except when this is not a Map, Array
// and we would like to keep the dots within the key name
List<String> methods = OgnlHelper.splitOgnl(ognl);
for (String methodName : methods) {
BeanHolder holder = new ConstantBeanHolder(beanToCall, exchange.getContext());
// support the null safe operator
boolean nullSafe = OgnlHelper.isNullSafeOperator(methodName);
// keep up with how far are we doing
ognlPath += methodName;
// get rid of leading ?. or . as we only needed that to determine if null safe was enabled or not
methodName = OgnlHelper.removeLeadingOperators(methodName);
// are we doing an index lookup (eg in Map/List/array etc)?
String key = null;
KeyValueHolder<String, String> index = OgnlHelper.isOgnlIndex(methodName);
if (index != null) {
methodName = index.getKey();
key = index.getValue();
}
// only invoke if we have a method name to use to invoke
if (methodName != null) {
InvokeProcessor invoke = new InvokeProcessor(holder, methodName);
invoke.process(resultExchange);
// check for exception and rethrow if we failed
if (resultExchange.getException() != null) {
throw new RuntimeBeanExpressionException(exchange, beanName, methodName, resultExchange.getException());
}
result = invoke.getResult();
}
// if there was a key then we need to lookup using the key
if (key != null) {
result = lookupResult(resultExchange, key, result, nullSafe, ognlPath, holder.getBean());
}
// check null safe for null results
if (result == null && nullSafe) {
return;