in src/main/java/org/apache/commons/ognl/enhance/ExpressionCompiler.java [142:181]
public static String getRootExpression( Node expression, Object root, OgnlContext context )
{
String rootExpr = "";
if ( !shouldCast( expression ) )
{
return rootExpr;
}
if ( ( !(expression instanceof ASTList) && !(expression instanceof ASTVarRef)
&& !(expression instanceof ASTStaticMethod) && !(expression instanceof ASTStaticField)
&& !(expression instanceof ASTConst) && !(expression instanceof ExpressionNode)
&& !(expression instanceof ASTCtor) && !(expression instanceof ASTStaticMethod)
&& root != null ) || ( root != null && expression instanceof ASTRootVarRef) )
{
Class<?> castClass = OgnlRuntime.getCompiler( context ).getRootExpressionClass( expression, context );
if ( castClass.isArray() || expression instanceof ASTRootVarRef || expression instanceof ASTThisVarRef)
{
rootExpr = "((" + getCastString( castClass ) + ")$2)";
if ( expression instanceof ASTProperty && !( (ASTProperty) expression ).isIndexedAccess() )
{
rootExpr += ".";
}
}
else if ( ( expression instanceof ASTProperty && ( (ASTProperty) expression ).isIndexedAccess() )
|| expression instanceof ASTChain)
{
rootExpr = "((" + getCastString( castClass ) + ")$2)";
}
else
{
rootExpr = "((" + getCastString( castClass ) + ")$2).";
}
}
return rootExpr;
}