Hi Sloan,
>From a quick look at the digester code, I see that SetPropertiesRule
uses BeanUtils.populate(targetObject, valuesMap). Following this down, I
see that eventually java.beans.Introspector is called to get info about
the target class.
For my own interest, I looked into the JavaBeans spec, and it is quite
clear that this is the expected behavior (see Section 8.3.1). Because it
found a getFoo method returning type Y, but no setFoo(Y newFoo) method,
property Foo is regarded as readonly.
So I guess that what you are seeing is what is actually expected:
java.beans.Introspector is saying that "className" is a read-only
property.
I hadn't realized that digester's use of BeanUtils would force such a
strict compliance with the JavaBeans rules onto users of the Digester!
What you could do is write an explicit CallMethod rule for the className
attribute:
digester.addCallMethod(
"struts-config/action-mappings/action",
"setClassName", 1);
digester.addCallParam(
"struts-config/action-mappings/action", 0, "className");
The CallMethodRule uses MethodUtils.invokeMethod, which should find the
setClassName method without any problems.
Maybe it is also possible to write a BeanInfo class for your target
class to force className to be recognised as a bean property?
Or you could define getActionMappingClass to return a string, and have
getActionMappingClassAsClass to return the Class representation...
Or you could define a ConvertUtils converter which can convert string
--> class, then define setActionMappingClass(Class) instead of
setActionMappingClass(String). I'm sure that BeanUtils.setProperty uses
ConvertUtils internally...
Regards,
Simon
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]