bval-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: bval git commit: ensure isGetter methods are consistent between them
Date Thu, 17 May 2018 05:23:21 GMT
fixed hopefully

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>


Le jeu. 17 mai 2018 à 07:09, Romain Manni-Bucau <rmannibucau@gmail.com> a
écrit :

> Seems you are right, idea was to include the length check but got too
> gluton.
>
> Le jeu. 17 mai 2018 00:27, Matt Benson <mbenson@apache.org> a écrit :
>
>> 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 <rmannibucau@apache.org> 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 <rmannibucau@apache.org>
>>> Authored: Wed May 16 22:52:43 2018 +0200
>>> Committer: Romain Manni-Bucau <rmannibucau@apache.org>
>>> 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);
>>>      }
>>>
>>>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message