[hibernate-commits] Hibernate SVN: r16522 - validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Thu May 7 16:33:16 EDT 2009
Author: epbernard
Date: 2009-05-07 16:33:16 -0400 (Thu, 07 May 2009)
New Revision: 16522
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/ReflectionHelper.java
Log:
fix bug with isGetter not retrieved when getMethod is used
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/ReflectionHelper.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/ReflectionHelper.java 2009-05-07 18:38:51 UTC (rev 16521)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/util/ReflectionHelper.java 2009-05-07 20:33:16 UTC (rev 16522)
@@ -393,21 +393,7 @@
* false</code> otherwise.
*/
public static boolean containsMethod(Class<?> clazz, String methodName) {
- try {
- char string[] = methodName.toCharArray();
- string[0] = Character.toUpperCase( string[0] );
- methodName = new String( string );
- try {
- clazz.getMethod( "get" + methodName );
- }
- catch ( NoSuchMethodException e ) {
- clazz.getMethod( "is" + methodName );
- }
- return true;
- }
- catch ( NoSuchMethodException e ) {
- return false;
- }
+ return getMethod( clazz, methodName ) != null;
}
/**
@@ -420,7 +406,15 @@
*/
public static Method getMethod(Class<?> clazz, String methodName) {
try {
- return clazz.getMethod( "get" + methodName.substring( 0, 1 ).toUpperCase() + methodName.substring( 1 ) );
+ char string[] = methodName.toCharArray();
+ string[0] = Character.toUpperCase( string[0] );
+ methodName = new String( string );
+ try {
+ return clazz.getMethod( "get" + methodName );
+ }
+ catch ( NoSuchMethodException e ) {
+ return clazz.getMethod( "is" + methodName );
+ }
}
catch ( NoSuchMethodException e ) {
return null;
More information about the hibernate-commits
mailing list