Commit d62a988d authored by Matija Obreza's avatar Matija Obreza
Browse files

Accession API: Fixed updating "historic" and "available"

- Allowing for "isHistoric" getter in addition to "getHistoric"
parent 50754f54
......@@ -449,13 +449,16 @@ public class AccessionUploader implements InitializingBean {
private Method findGetter(Class<?> clazz, Class<?> returnType, String fieldName) {
String getterName = "get" + WordUtils.capitalize(fieldName);
String getterName2 = "is" + WordUtils.capitalize(fieldName);
LOG.trace("Looking for getter {}", getterName);
for (Method method : clazz.getMethods()) {
if (method.getParameterCount() == 0 && returnType.isAssignableFrom(method.getReturnType()) && method.getName().equals(getterName)) {
if (method.getParameterCount() == 0 && returnType.isAssignableFrom(method.getReturnType()) && (method.getName().equals(getterName) || method.getName().equals(getterName2))) {
LOG.trace("Found getter {}", method);
return method;
}
}
throw new RuntimeException("No getter for field " + fieldName + " in " + clazz.getName());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment