Object o = muleContext.getRegistry().lookupObject(name);
if (o == null && objectRequired)
{
throw new ExpressionRuntimeException(CoreMessages.expressionEvaluatorReturnedNull(NAME, expression));
}
else if (o == null || property == null)
{
return o;
}
else if(muleContext.getExpressionManager().isEvaluatorRegistered("bean"))
{
//Special handling of Mule object types
if(o instanceof AbstractEndpointBuilder)
{
property = "endpointBuilder.endpoint." + property;
}
Object p = muleContext.getExpressionManager().evaluate("#[bean:" + property + "]", new DefaultMuleMessage(o, muleContext));
if (p == null && propertyRequired)
{
throw new ExpressionRuntimeException(CoreMessages.expressionEvaluatorReturnedNull(NAME, name + "." + property));
}
else
{
return p;
}
}
else
{
throw new ExpressionRuntimeException(CoreMessages.expressionEvaluatorNotRegistered("bean"));
}
}