public static boolean isConstant ( Expression expression , Object expected ) { return expression instanceof ConstantExpression && expected . equals ( ( ( ConstantExpression ) expression ) . getValue ( ) ) ; }
Tells you if an expression is the expected constant .