NIHVIVO-1512 ReadOnlyBeansWrapper exposes getters and not setters, though the identification of a setter is only approximated.

This commit is contained in:
ryounes 2011-07-26 20:21:17 +00:00
parent ba11f54394
commit 655d92284c
3 changed files with 21 additions and 11 deletions

View file

@ -27,11 +27,13 @@ public class ReadOnlyBeansWrapper extends BeansWrapper {
@Override
protected void finetuneMethodAppearance(Class cls, Method method, MethodAppearanceDecision decision) {
if ( method.getName().startsWith("set") ||
method.getReturnType() == null ) {
// How to define a setter? This is an approximation: a method whose name
// starts with "set" or returns void.
if ( method.getName().startsWith("set") ) {
decision.setExposeMethodAs(null);
}
} else if ( method.getReturnType().getName().equals("void") ) {
decision.setExposeMethodAs(null);
}
}
}