From 339365657f3041060a0c7a91eff7aa5dc4bbedd6 Mon Sep 17 00:00:00 2001 From: erik Date: Thu, 22 Jul 2010 11:18:37 +0000 Subject: [PATCH] --- .../wamblee/conditions/PropertyRegexCondition.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/support/general/src/main/java/org/wamblee/conditions/PropertyRegexCondition.java b/support/general/src/main/java/org/wamblee/conditions/PropertyRegexCondition.java index b5ce9c5d..3b9cfef4 100644 --- a/support/general/src/main/java/org/wamblee/conditions/PropertyRegexCondition.java +++ b/support/general/src/main/java/org/wamblee/conditions/PropertyRegexCondition.java @@ -15,10 +15,8 @@ */ package org.wamblee.conditions; -import org.apache.commons.beanutils.PropertyUtils; - import java.lang.reflect.InvocationTargetException; - +import java.lang.reflect.Method; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -71,7 +69,9 @@ public class PropertyRegexCondition implements Condition { */ public boolean matches(T aObject) { try { - String value = PropertyUtils.getProperty(aObject, property) + ""; + String readerName = "get" + property.substring(0, 1).toUpperCase() + property.substring(1); + Method reader = aObject.getClass().getMethod(readerName); + String value = reader.invoke(aObject) + ""; if (tolower) { value = value.toLowerCase(); @@ -80,12 +80,12 @@ public class PropertyRegexCondition implements Condition { Matcher matcher = regex.matcher(value); return matcher.matches(); + } catch (NoSuchMethodException e) { + throw new RuntimeException(e.getMessage(), e); } catch (IllegalAccessException e) { throw new RuntimeException(e.getMessage(), e); } catch (InvocationTargetException e) { throw new RuntimeException(e.getMessage(), e); - } catch (NoSuchMethodException e) { - throw new RuntimeException(e.getMessage(), e); - } + } } } -- 2.31.1