final int sum
= (hasText(f.query()) ? 1 : 0)
+ (hasText(f.queryName()) ? 1 : 0)
+ (hasText(f.sqlQuery()) ? 1 : 0)
+ (hasText(f.sqlQueryName()) ? 1 : 0);
if (sum < 1)
throw new SpecificationViolationException("You need to specify at least one of: query, queryName, sqlQuery, sqlQueryName", method);
if (sum > 1)
throw new SpecificationViolationException("You can specify only one of: query, queryName, sqlQuery, sqlQueryName", method);