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/a9610dc1 Tree: http://git-wip-us.apache.org/repos/asf/bval/tree/a9610dc1 Diff: http://git-wip-us.apache.org/repos/asf/bval/diff/a9610dc1 Branch: refs/heads/bv2 Commit: a9610dc1d79166f66950e5c9f7a356e27764b3ce Parents: 21c1ed9 Author: Romain Manni-Bucau <[email protected]> Authored: Wed May 16 22:52:43 2018 +0200 Committer: Matt Benson <[email protected]> Committed: Tue Oct 16 12:28:20 2018 -0500 ---------------------------------------------------------------------- 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/a9610dc1/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); }
