*
* @throws RestAnnotationException if the mapping is invalid
*/
protected final ParameterAnnotationMapping parseAnnotationLiterals(final Literal parameterName, final Literal functionArgumentName, final Cardinality requiredCardinality) throws RestAnnotationException {
if(parameterName.getType() != Type.STRING) {
throw new RestAnnotationException(getInvalidParameterNameErr());
}
if(functionArgumentName.getType() != Type.STRING) {
throw new RestAnnotationException(getInvalidFunctionArgumentNameErr());
}
final String keyStr = parameterName.getValue();
final String varStr = functionArgumentName.getValue();
if(keyStr.isEmpty()) {
throw new RestAnnotationException(getInvalidParameterNameErr());
}
if(varStr.isEmpty()) {
throw new RestAnnotationException(getInvalidFunctionArgumentNameErr());
}
//validate the varStr
final Matcher mtcFnParameter = functionArgumentPattern.matcher(varStr);
if(!mtcFnParameter.matches()) {
throw new RestAnnotationException(getInvalidAnnotationParametersSyntaxErr());
}
final String varName = mtcFnParameter.group(1);
//check the function declares the var with the correct cardinality