Author: shane.bryzak(a)jboss.com
Date: 2010-07-05 23:36:26 -0400 (Mon, 05 Jul 2010)
New Revision: 6585
Modified:
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/FieldPropertyImpl.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/MethodPropertyImpl.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/Property.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/query/PropertyQuery.java
Log:
fix query criteria, introduce read only flag for properties
Modified:
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/FieldPropertyImpl.java
===================================================================
---
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/FieldPropertyImpl.java 2010-07-06
00:08:38 UTC (rev 6584)
+++
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/FieldPropertyImpl.java 2010-07-06
03:36:26 UTC (rev 6585)
@@ -96,4 +96,8 @@
return field.getDeclaringClass();
}
+ public boolean isReadOnly()
+ {
+ return false;
+ }
}
\ No newline at end of file
Modified:
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/MethodPropertyImpl.java
===================================================================
---
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/MethodPropertyImpl.java 2010-07-06
00:08:38 UTC (rev 6584)
+++
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/MethodPropertyImpl.java 2010-07-06
03:36:26 UTC (rev 6585)
@@ -123,7 +123,7 @@
}
}
}
- throw new IllegalArgumentException("no such setter method: " +
clazz.getName() + '.' + name);
+ return null;
}
private static Method getGetterMethod(Class<?> clazz, String name)
@@ -156,5 +156,10 @@
{
return getterMethod.getDeclaringClass();
}
+
+ public boolean isReadOnly()
+ {
+ return setterMethod == null;
+ }
}
\ No newline at end of file
Modified:
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/Property.java
===================================================================
---
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/Property.java 2010-07-06
00:08:38 UTC (rev 6584)
+++
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/Property.java 2010-07-06
03:36:26 UTC (rev 6585)
@@ -71,4 +71,11 @@
* @return
*/
public Class<?> getDeclaringClass();
+
+ /**
+ * Indicates whether this is a read-only property
+ *
+ * @return
+ */
+ boolean isReadOnly();
}
\ No newline at end of file
Modified:
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/query/PropertyQuery.java
===================================================================
---
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/query/PropertyQuery.java 2010-07-06
00:08:38 UTC (rev 6584)
+++
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/query/PropertyQuery.java 2010-07-06
03:36:26 UTC (rev 6585)
@@ -52,7 +52,7 @@
// First check public accessor methods (we ignore private methods)
for (Method method : targetClass.getMethods())
{
- if (!(method.getName().startsWith("is") ||
method.getName().startsWith("get"))) break;
+ if (!(method.getName().startsWith("is") ||
method.getName().startsWith("get"))) continue;
boolean match = true;
for (PropertyCriteria c : criteria)
Show replies by date