*
* @throws InvalidQueryException Thrown if the parameters are invalid.
*/
public void validateParameters(List<ValueType> types) throws InvalidQueryException {
if (types.size() != 1) {
throw new InvalidQueryException("Number of parameters for "
+ timeComponent.getName() + "function is wrong: " + types.size());
}
switch (timeComponent) {
case YEAR:
case MONTH:
case DAY:
case QUARTER:
case DAY_OF_WEEK:
if ((types.get(0) != ValueType.DATE)
&& (types.get(0) != ValueType.DATETIME)) {
throw new InvalidQueryException("Can't perform the function "
+ timeComponent.getName() + " on a column that is not a Date or"
+ " a DateTime column");
}
break;
case HOUR:
case MINUTE:
case SECOND:
case MILLISECOND:
if ((types.get(0) != ValueType.TIMEOFDAY)
&& (types.get(0) != ValueType.DATETIME)) {
throw new InvalidQueryException("Can't perform the function "
+ timeComponent.getName() + " on a column that is not a "
+ "TimeOfDay or a DateTime column");
}
break;
}