Hi Romain, Doesn't this change allow the possibility of, e.g.: Integer isFoo()
Being accepted as a valid Java bean property accessor when, in fact, it is not? Br, Matt On Wed, May 16, 2018, 3:53 PM <[email protected]> wrote: > Repository: bval > Updated Branches: > refs/heads/bv2 2c80d64d3 -> 4d1d208ae > > > ensure isGetter methods are consistent between them > > > Project: http://git-wip-us.apache.org/repos/asf/bval/repo > Commit: http://git-wip-us.apache.org/repos/asf/bval/commit/4d1d208a > Tree: http://git-wip-us.apache.org/repos/asf/bval/tree/4d1d208a > Diff: http://git-wip-us.apache.org/repos/asf/bval/diff/4d1d208a > > Branch: refs/heads/bv2 > Commit: 4d1d208aec2252092cbe09fd88da4f2740bc19f6 > Parents: 2c80d64 > Author: Romain Manni-Bucau <[email protected]> > Authored: Wed May 16 22:52:43 2018 +0200 > Committer: Romain Manni-Bucau <[email protected]> > Committed: Wed May 16 22:52:43 2018 +0200 > > ---------------------------------------------------------------------- > bval-jsr/src/main/java/org/apache/bval/jsr/util/Methods.java | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > ---------------------------------------------------------------------- > > > > http://git-wip-us.apache.org/repos/asf/bval/blob/4d1d208a/bval-jsr/src/main/java/org/apache/bval/jsr/util/Methods.java > ---------------------------------------------------------------------- > diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/util/Methods.java > b/bval-jsr/src/main/java/org/apache/bval/jsr/util/Methods.java > index d0d5bdb..d8f2875 100644 > --- a/bval-jsr/src/main/java/org/apache/bval/jsr/util/Methods.java > +++ b/bval-jsr/src/main/java/org/apache/bval/jsr/util/Methods.java > @@ -33,10 +33,10 @@ public final class Methods { > return false; > } > // TODO look for capital letter after verb? > - if (Boolean.TYPE.equals(m.getReturnType()) && > m.getName().startsWith("is")) { > + if (Boolean.TYPE.equals(m.getReturnType()) && > isGetter(m.getName())) { > return true; > } > - return !Void.TYPE.equals(m.getReturnType()) && > m.getName().startsWith("get"); > + return !Void.TYPE.equals(m.getReturnType()) && > isGetter(m.getName()); > } > > public static boolean isGetter(String methodName) { > @@ -51,7 +51,7 @@ public final class Methods { > } > > public static String propertyName(String methodName) { > - Validate.isTrue(isGetter(methodName), "%s does not represent a > property getter"); > + Validate.isTrue(isGetter(methodName), "%s does not represent a > property getter", methodName); > final String suffix = methodName.startsWith("is") ? > methodName.substring(2) : methodName.substring(3); > return Introspector.decapitalize(suffix); > } > >
