private static boolean isParameterized ( VoltXMLElement elm ) { final String name = elm . name ; if ( name . equals ( "value" ) ) { return elm . getBoolAttribute ( "isparam" , false ) ; } else if ( name . equals ( "vector" ) || name . equals ( "row" ) ) { return elm . children . stream ( ) . anyMatch ( ExpressionUtil :: isParameterized ) ; } else if ( name . equals ( "columnref" ) || name . equals ( "function" ) || name . equals ( "tablesubquery" ) ) { return false ; } else { assert name . equals ( "operation" ) : "unknown VoltXMLElement type: " + name ; final ExpressionType op = mapOfVoltXMLOpType . get ( elm . attributes . get ( "optype" ) ) ; assert op != null ; switch ( op ) { case CONJUNCTION_OR : // two operators case CONJUNCTION_AND : case COMPARE_GREATERTHAN : case COMPARE_LESSTHAN : case COMPARE_EQUAL : case COMPARE_NOTEQUAL : case COMPARE_GREATERTHANOREQUALTO : case COMPARE_LESSTHANOREQUALTO : case OPERATOR_PLUS : case OPERATOR_MINUS : case OPERATOR_MULTIPLY : case OPERATOR_DIVIDE : case OPERATOR_CONCAT : case OPERATOR_MOD : case COMPARE_IN : return isParameterized ( elm . children . get ( 0 ) ) || isParameterized ( elm . children . get ( 1 ) ) ; case OPERATOR_IS_NULL : // one operator case OPERATOR_EXISTS : case OPERATOR_NOT : case OPERATOR_UNARY_MINUS : return isParameterized ( elm . children . get ( 0 ) ) ; default : assert false ; return false ; } } }
Helper to check if a VoltXMLElement contains parameter .