final Class<?> actualParamType)
{
String paramName = param.getName();
if (!paramName.isEmpty() && paramNames.contains(paramName))
{
throw new ResourceConfigException("Parameter '" + paramName + "' on "
+ buildMethodMessage(method) + " is specified more than once");
}
paramNames.add(paramName);
if (!actualParamType.isAssignableFrom(param.getType()))
{
throw new ResourceConfigException("Parameter '" + paramName + "' on "
+ buildMethodMessage(method) + " is not a valid type '" + actualParamType
+ "'. Must be assignable from '" + param.getType() + "'.");
}
if (methodType == ResourceMethod.ACTION)
{
if (annotations.contains(QueryParam.class))
{
throw new ResourceConfigException("Parameter '" + paramName + "' on "
+ buildMethodMessage(method) + " is a @QueryParam but action method cannot have @QueryParam");
}
if (param.getParamType() == Parameter.ParamType.POST
&& !(checkParameterType(param.getType(), RestModelConstants.VALID_ACTION_PARAMETER_TYPES) ||
checkParameterHasTyperefSchema(param)))
{
throw new ResourceConfigException("Parameter '" + paramName + "' on "
+ buildMethodMessage(method) + " is not a valid type (" + param.getType() + ')');
}
}
else if (param.getParamType() == Parameter.ParamType.QUERY
&& !(checkParameterType(param.getType(), RestModelConstants.VALID_QUERY_PARAMETER_TYPES) ||
checkParameterHasTyperefSchema(param)))
{
throw new ResourceConfigException("Parameter '" + paramName + "' on "
+ buildMethodMessage(method) + " is not a valid type (" + param.getType() + ')');
}
if (param.getType().isPrimitive() && param.isOptional() && !param.hasDefaultValue())
{
throw new ResourceConfigException("Parameter '"
+ paramName
+ "' on "
+ buildMethodMessage(method)
+ " is a primitive type, but does not specify a default value in the @Optional annotation");
}
final String checkTyperefMessage = checkTyperefSchema(param.getType(), param.getDataSchema());
if (checkTyperefMessage != null)
{
throw new ResourceConfigException("Parameter '" + paramName + "' on "
+ buildMethodMessage(method) + ", " + checkTyperefMessage);
}
if (annotationCount(annotations) > 1)
{
throw new ResourceConfigException(buildMethodMessage(method)
+ "' must declare only one of @QueryParam, @ActionParam, @AssocKeyParam, @PagingContextParam, or @CallbackParam");
}
}