final TypeClassPair tcp = ReflectionHelper.getTypeArgumentAndClass(parameterType);
if (tcp == null || tcp.c == String.class) {
return CollectionStringExtractor.getInstance(
parameter, parameterName, defaultValue);
} else {
final StringReader sr = w.getStringReader(tcp.c, tcp.t, annotations);
if (sr == null)
return null;
try {
return CollectionStringReaderExtractor.getInstance(
parameter, sr, parameterName, defaultValue);
} catch (Exception e) {
throw new ContainerException("Could not process parameter type " + parameter, e);
}
}
} else if (parameter == String.class) {
return new StringExtractor(parameterName, defaultValue);
} else if (parameter.isPrimitive()) {
// Convert primitive to wrapper class
parameter = PrimitiveMapper.primitiveToClassMap.get(parameter);
if (parameter == null) {
// Primitive type not supported
return null;
}
// Check for static valueOf(String )
Method valueOf = ReflectionHelper.getValueOfStringMethod(parameter);
if (valueOf != null) {
try {
Object defaultDefaultValue = PrimitiveMapper.primitiveToDefaultValueMap.get(parameter);
return new PrimitiveValueOfExtractor(valueOf, parameterName,
defaultValue, defaultDefaultValue);
} catch (Exception e) {
throw new ContainerException(ImplMessages.DEFAULT_COULD_NOT_PROCESS_METHOD(defaultValue, valueOf));
}
}
} else {
final StringReader sr = w.getStringReader(parameter, parameterType, annotations);
if (sr == null)
return null;
try {
return new StringReaderExtractor(sr, parameterName, defaultValue);