QueryParam queryParam = annotations.get(QueryParam.class);
Optional optional = annotations.get(Optional.class);
String paramName = queryParam.value();
if (INVALID_CHAR_PATTERN.matcher(paramName).find())
{
throw new ResourceConfigException("Unsupported character in the parameter name :"
+ paramName);
}
Class<? extends TyperefInfo> typerefInfoClass = queryParam.typeref();
try
{
@SuppressWarnings({"unchecked", "rawtypes"})
Parameter<?> param =
new Parameter(queryParam.value(),
paramType,
getDataSchema(paramType, getSchemaFromTyperefInfo(typerefInfoClass)),
optional != null,
getDefaultValueData(optional),
Parameter.ParamType.QUERY,
true,
annotations);
return param;
}
catch (TemplateRuntimeException e)
{
throw new ResourceConfigException("DataSchema for parameter '" + paramName + "' of type " + paramType.getSimpleName() + " on "
+ buildMethodMessage(method) + "cannot be found; type is invalid or requires typeref", e);
}
catch (Exception e)
{
throw new ResourceConfigException("Typeref for parameter '" + paramName + "' on "
+ buildMethodMessage(method) + " cannot be instantiated, " + e.getMessage(), e);
}
}