Was a little too fast and did only run the test cases... BeanInfo does some
strange capitalization... This path seems to run fine on our test system.
On 1/13/07, Henri Dupre <[EMAIL PROTECTED]> wrote:
Patch attached... Includes test case.
On 1/13/07, Henri Dupre <[EMAIL PROTECTED]> wrote:
>
> One difference with ognl is that ognl allows the first letter of a
> binding to be capitalized:
>
> ognl:article.Type_Garantie would map to
>
> *public* java.lang.String getType_Garantie () {
> *return* *this*.Type_Garantie;
> }
> whereas with prop it fails. With prop only prop:article.type_Garantie is
> valid.
> --
> Henri Dupre
> Actualis Center
>
--
Henri Dupre
Actualis Center
--
Henri Dupre
Actualis Center
Index:
D:/Devel/Actualis/tapestry-prop/src/main/java/com/javaforge/tapestry/prop/PropertyAccessorClassFactoryImpl.java
===================================================================
---
D:/Devel/Actualis/tapestry-prop/src/main/java/com/javaforge/tapestry/prop/PropertyAccessorClassFactoryImpl.java
(revision 287)
+++
D:/Devel/Actualis/tapestry-prop/src/main/java/com/javaforge/tapestry/prop/PropertyAccessorClassFactoryImpl.java
(working copy)
@@ -182,6 +182,16 @@
return ClassFabUtils.generateClassName(targetClass.getName() +
"$access_"
+ propertyPath.replace('.', '_'));
}
+
+ static String unCapinalize(String propName) {
+ if (propName == null || propName.length() == 0)
+ return propName;
+ if (Character.isLowerCase(propName.charAt(0)))
+ return propName;
+ char[] out = propName.toCharArray();
+ out[0] = Character.toLowerCase(out[0]);
+ return new String(out);
+ }
private PropertyDescriptor findPropertyDescriptor(Class propertyClass,
String propertyName)
{
@@ -191,7 +201,7 @@
for (int i = 0; i < descriptors.length; i++)
{
- if (descriptors[i].getName().equals(propertyName)) return
descriptors[i];
+ if
(unCapinalize(descriptors[i].getName()).equals(unCapinalize(propertyName)))
return descriptors[i];
}
throw new ApplicationRuntimeException(PropMessages.noSuchProperty(
Index:
D:/Devel/Actualis/tapestry-prop/src/test/java/org/apache/tapestry/prop/PropertyAccessorClassFactoryTest.java
===================================================================
---
D:/Devel/Actualis/tapestry-prop/src/test/java/org/apache/tapestry/prop/PropertyAccessorClassFactoryTest.java
(revision 287)
+++
D:/Devel/Actualis/tapestry-prop/src/test/java/org/apache/tapestry/prop/PropertyAccessorClassFactoryTest.java
(working copy)
@@ -87,7 +87,7 @@
{
Asymetric as = new Asymetric();
- PropertyAccessor pa = createAccessor(as, "readOnly");
+ PropertyAccessor pa = createAccessor(as, "ReadOnly");
as._readOnly = "yep";
@@ -92,6 +92,10 @@
as._readOnly = "yep";
assertEquals(pa.readProperty(), "yep");
+
+ pa = createAccessor(as, "readOnly");
+
+ assertEquals(pa.readProperty(), "yep");
try
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]