Hi,<br><br>I was working on a Guvnor related JIRA, <a href="https://issues.jboss.org/browse/GUVNOR-1573">https://issues.jboss.org/browse/GUVNOR-1573</a>, and found that the above does not work well for "delegated properties".<br>
<br>Consider the following:-<br><br><span style="font-family:courier new,monospace">public class MotherClass {</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> </span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> private Status status;</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> public Status getStatus() {</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> return status;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> }</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> public void setStatus(Status status) {</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> this.status = status;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> }</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">}</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">public class DelegationClass {</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> private MotherClass delegated;</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> public Status getStatus() {</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> return delegated.getStatus();</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> }</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> public void setStatus(Status status) {</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> delegated.setStatus( status );</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> }</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">}</span><br><br style="font-family:arial,helvetica,sans-serif">
Method "storeGetterSetter" attempts to align a method getter\setter with a Field.<br><br>When the class being inspected is a regular class (or subclass) getters\setters normally relate to a member Field, however in the case of a delegated property (DelegationClass.getStatus, in the example) no field obviously exists and hence the stored Field is null. I've worked around this in Guvnor by using the method's return type when the ClassFieldInspector.getFieldTypesField() returns null however this should, IMO, ideally be moved to ClassFieldInspector. I haven't been so bold as to change ClassFieldInspector as it means moving from storing "Fields" in the "fieldTypesField" Map to something more generic (that can handle Method return types too) that'll probably impact alot elsewhere.<br>
<br>Is this a known limitation, with perhaps an existing JIRA, or shall I raise a new one?<br><br>Thanks,<br><br>Mike<br><br>