You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cs...@apache.org on 2006/03/09 23:13:09 UTC

svn commit: r384630 - in /beehive/trunk/controls: src/runtime/org/apache/beehive/controls/runtime/generator/ test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/ test/src/junit-controls/org/apache/beehive/controls/test/con...

Author: cschoett
Date: Thu Mar  9 14:13:07 2006
New Revision: 384630

URL: http://svn.apache.org/viewcvs?rev=384630&view=rev
Log:
Fix for BEEHIVE-1078, updated AptControlInteface to build a list of properties derived from getter and setter methods on the control interface.  These properties get added into the generated BeanInfo's set of PropertyDescriptors.  Added new DRT's for this case as well.

Some minor cleanup on my fix for BEEHIVE-1077, PropertyDescriptor counnts weren't being set correctly if the control interface included a PropertySet which was marked as optional=true and hasSetters=false.


Added:
    beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterfaceProperty.java   (with props)
    beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/
    beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/CtrlExtension.java   (with props)
    beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/ExtCtrl.java   (with props)
    beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/ExtCtrlImpl.java   (with props)
    beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/InterfaceGetterSetter.java   (with props)
    beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/InterfaceGetterSetterImpl.java   (with props)
Modified:
    beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
    beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptMethod.java
    beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBeanInfo.vm
    beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/propertiesoptional/OptionalPropertySet.java
    beehive/trunk/controls/test/src/junit-tests/org/apache/beehive/controls/test/junit/PropertyTest.java

Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java?rev=384630&r1=384629&r2=384630&view=diff
==============================================================================
--- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java (original)
+++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java Thu Mar  9 14:13:07 2006
@@ -90,6 +90,8 @@
 
         _operations = initOperations();
 
+        _intfProps = initIntfProperties();
+
         _propertySets = initPropertySets();
 
         _eventSets = initEventSets();
@@ -414,13 +416,24 @@
         else
             count = _superClass.getPropertyCount();
 
-        for (AptPropertySet propertySet : _propertySets)
-            count += propertySet.getProperties().size();
+        for (AptPropertySet propertySet : _propertySets) {
+            // if a property set is set to optional and hasSetters is set to false,
+            // there isn't a getter or setter available for that property
+            if (propertySet.hasSetters() || !propertySet.isOptional()) {
+                count += propertySet.getProperties().size();
+            }
+        }
 
+        count += _intfProps.size();
         return count;
     }
 
     /**
+     * Returns the list of properties defined by getter and setter methods in this control interface.
+     */
+    public Collection<AptControlInterfaceProperty> getInterfaceProperties() { return _intfProps; }
+
+    /**
      * Returns true if the interface has any bound properties associated with it.
      */
     public boolean hasBoundProperties()
@@ -972,18 +985,155 @@
         }
     }
 
-    private AptControlInterface         _superClass;
-    private AptMethodSet<AptOperation>  _operations;
-    private ArrayList<AptPropertySet>   _propertySets;
-    private boolean                     _isExtension;        // true if ControlExtension, else ControlInterface
-    private boolean                     _hasBoundProperties;
-    private boolean                     _hasConstrainedProperties;;
-    private ArrayList<AptEventSet>      _eventSets;
-    private ControlBean                 _bean;
-    private FeatureInfo                 _featureInfo;
-    private Version                     _version;
-    private VersionRequired             _versionRequired;
-    private InterfaceDeclaration        _intfDecl;
-    private InterfaceDeclaration        _superDecl;
-    private TwoPhaseAnnotationProcessor  _ap;
+    /**
+     * Build a list of properties defined by getter/setter methods on this control interface.
+     */
+    private ArrayList<AptControlInterfaceProperty> initIntfProperties() {
+
+        HashMap<String, AptControlInterfaceProperty> intfPropMap = new HashMap<String, AptControlInterfaceProperty>();
+
+        Collection<AptOperation> ops = getOperations();
+        for (AptOperation op : ops) {
+            String opName = op.getName();
+            if (!op.isPublic()) {
+                continue;
+            }
+
+            if (isGetter(op)) {
+                String propertyName = getIntfPropertyName(op);
+                if (intfPropMap.containsKey(propertyName)) {
+                    intfPropMap.get(propertyName).setGetterName(opName);
+                }
+                else {
+                    intfPropMap.put(propertyName, new AptControlInterfaceProperty(propertyName, opName, null));
+                }
+            }
+            else if (isSetter(op)) {
+                String propertyName = getIntfPropertyName(op);
+                if (intfPropMap.containsKey(propertyName)) {
+                    intfPropMap.get(propertyName).setSetterName(opName);
+                }
+                else {
+                    intfPropMap.put(propertyName, new AptControlInterfaceProperty(propertyName, null, opName));
+                }
+            }
+            else if (isIsGetter(op)) {
+                String propertyName = getIntfPropertyName(op);
+                if (intfPropMap.containsKey(propertyName)) {
+                    intfPropMap.get(propertyName).setGetterName(opName);
+                }
+                else {
+                    intfPropMap.put(propertyName, new AptControlInterfaceProperty(propertyName, opName, null));
+                }
+            }
+        }
+        return new ArrayList<AptControlInterfaceProperty>(intfPropMap.values());
+    }
+
+    /**
+     * Does the method have a Java Beans getter method signature.
+     * @param method AptMethod instance
+     * @return true if getter
+     */
+    private boolean isGetter(AptMethod method) {
+        String methodName = method.getName();
+
+        if (methodName.length() < 4)
+            return false;
+
+        if (!methodName.startsWith("get"))
+            return false;
+
+        if (method.getArgList().length() > 0)
+            return false;
+
+        if ("void".equals(method.getReturnType()))
+            return false;
+
+        return true;
+    }
+
+    /**
+     * Does the method have a Java Beans getter method signature (is varient).
+     * @param method AptMethod instance.
+     * @return true if 'is' getter.
+     */
+    private boolean isIsGetter(AptMethod method) {
+        String methodName = method.getName();
+
+        if (methodName.length() < 3)
+            return false;
+
+        if (!methodName.startsWith("is"))
+            return false;
+
+        if (method.getArgList().length() > 0)
+            return false;
+
+        if (!"boolean".equals(method.getReturnType()))
+            return false;
+
+        return true;
+    }
+
+    /**
+     * Does the method have a Java Beans setter method signature (is varient).
+     * @param method AptMethod instance.
+     * @return true if setter.
+     */
+    private boolean isSetter(AptMethod method) {
+        String methodName = method.getName();
+
+        if (methodName.length() < 4)
+            return false;
+
+        if (!methodName.startsWith("set"))
+            return false;
+
+        String argList = method.getArgList();
+        if (argList.length() == 0)
+            return false;
+
+        if (argList.indexOf(',') > -1)
+            return false;
+
+        if (!"void".equals(method.getReturnType()))
+            return false;
+
+        return true;
+    }
+
+    /**
+     * Generate a property name from a method name.
+     * @param method AptMethod instance.
+     * @return property name.
+     */
+    private String getIntfPropertyName(AptMethod method) {
+        String opName = method.getName();
+
+        int prefixIdx = 3;
+        if (opName.startsWith("is"))
+            prefixIdx = 2;
+
+        if (opName.length() == prefixIdx + 1)
+            return "" + Character.toLowerCase(opName.charAt(prefixIdx));
+
+        return Character.toLowerCase(opName.charAt(prefixIdx)) + opName.substring(prefixIdx+1);
+    }
+
+    private ArrayList<AptControlInterfaceProperty>  _intfProps;
+    private AptControlInterface                     _superClass;
+    private AptMethodSet<AptOperation>              _operations;
+    private ArrayList<AptPropertySet>               _propertySets;
+    private boolean                                 _isExtension;        // true if ControlExtension, else ControlInterface
+    private boolean                                 _hasBoundProperties;
+    private boolean                                 _hasConstrainedProperties;
+    private ArrayList<AptEventSet>                  _eventSets;
+    private ControlBean                             _bean;
+    private FeatureInfo                             _featureInfo;
+    private Version                                 _version;
+    private VersionRequired                         _versionRequired;
+    private InterfaceDeclaration                    _intfDecl;
+    private InterfaceDeclaration                    _superDecl;
+    private TwoPhaseAnnotationProcessor             _ap;
 }

Added: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterfaceProperty.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterfaceProperty.java?rev=384630&view=auto
==============================================================================
--- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterfaceProperty.java (added)
+++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterfaceProperty.java Thu Mar  9 14:13:07 2006
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.runtime.generator;
+
+/**
+ * A property derived from a getter/setter method of the control interface.
+ */
+public final class AptControlInterfaceProperty {
+    private final String _name;
+    private String _setterName;
+    private String _getterName;
+
+    /**
+     * Constructs a new AptControlInterfaceProperty instance.
+     *
+     * @param name       Property name, may not be null.
+     * @param getterName Getter method name, may be null.
+     * @param setterName Setter method name, may be null.
+     */
+    public AptControlInterfaceProperty(String name, String getterName, String setterName) {
+        assert name != null;
+        _name = name;
+        _getterName = getterName;
+        _setterName = setterName;
+    }
+
+    /**
+     * Set the setter method name.
+     *
+     * @param setterName
+     */
+    protected void setSetterName(String setterName) {
+        _setterName = setterName;
+    }
+
+    /**
+     * Set the getter method name.
+     *
+     * @param getterName
+     */
+    protected void setGetterName(String getterName) {
+        _getterName = getterName;
+    }
+
+    /**
+     * Get the setter method name.
+     *
+     * @return setter method name, may be null.
+     */
+    public String getSetterName() {
+        return _setterName;
+    }
+
+    /**
+     * Get the getter method name.
+     *
+     * @return getter method name, may be null.
+     */
+    public String getGetterName() {
+        return _getterName;
+    }
+
+    /**
+     * Get the property name.
+     *
+     * @return Property name.
+     */
+    public String getName() {
+        return _name;
+    }
+}

Propchange: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterfaceProperty.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptMethod.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptMethod.java?rev=384630&r1=384629&r2=384630&view=diff
==============================================================================
--- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptMethod.java (original)
+++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptMethod.java Thu Mar  9 14:13:07 2006
@@ -26,6 +26,7 @@
 import com.sun.mirror.declaration.MethodDeclaration;
 import com.sun.mirror.declaration.ParameterDeclaration;
 import com.sun.mirror.declaration.TypeParameterDeclaration;
+import com.sun.mirror.declaration.Modifier;
 import com.sun.mirror.type.AnnotationType;
 import com.sun.mirror.type.DeclaredType;
 import com.sun.mirror.type.PrimitiveType;
@@ -359,6 +360,15 @@
      * Returns the unique index value for this method.
      */
     public int getIndex() { return _index; }
+
+    /**
+     * Is this a public method?
+     * @return true if public
+     */
+    protected boolean isPublic() {
+        Collection<Modifier> modifiers = _methodDecl.getModifiers();
+        return modifiers.contains(Modifier.PUBLIC);
+    }
 
     MethodDeclaration _methodDecl;
     int _index = -1;

Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBeanInfo.vm
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBeanInfo.vm?rev=384630&r1=384629&r2=384630&view=diff
==============================================================================
--- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBeanInfo.vm (original)
+++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBeanInfo.vm Thu Mar  9 14:13:07 2006
@@ -214,18 +214,38 @@
                 pd = new PropertyDescriptor(#localizeString("$property.name"), ${bean.className}.class, "$getterName", null );
                  #end
                 #end
-                #if ($property.propertyInfo)
+                #if ($propertySet.hasSetters() || !$propertySet.isOptional())
+                  #if ($property.propertyInfo)
                     pd.setBound($property.propertyInfo.bound());
                     pd.setConstrained($property.propertyInfo.constrained());
                     #if ($property.editorClass)
                     pd.setPropertyEditorClass(${property.editorClass}.class);
                     #end
-                #end
-                #if ($property.featureInfo)
+                  #end
+                  #if ($property.featureInfo)
                     #initFeatureDescriptor("pd" $property.featureInfo $property.name)
-                #end
+                  #end
                 propDescriptors[index++] = pd;
+                #end
             #end
+        #end
+
+        #if ($intf.interfaceProperties.size() > 0)
+        //
+        // add property descriptors for any getter/setters defined in control interface
+        //
+        #end
+        #foreach ($intfprop in $intf.interfaceProperties)
+          #if ($intfprop.getterName && $intfprop.setterName)
+                pd = new PropertyDescriptor(#localizeString("$intfprop.name"), ${bean.className}.class, "$intfprop.getterName", "$intfprop.setterName");
+                propDescriptors[index++] = pd;
+          #elseif ($intfprop.getterName)
+                pd = new PropertyDescriptor(#localizeString("$intfprop.name"), ${bean.className}.class, "$intfprop.getterName", null);
+                propDescriptors[index++] = pd;
+          #elseif ($intfprop.setterName)
+                pd = new PropertyDescriptor(#localizeString("$intfprop.name"), ${bean.className}.class, null, "$intfprop.setterName");
+                propDescriptors[index++] = pd;
+          #end
         #end
 
         #if ($intf.superClass)

Added: beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/CtrlExtension.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/CtrlExtension.java?rev=384630&view=auto
==============================================================================
--- beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/CtrlExtension.java (added)
+++ beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/CtrlExtension.java Thu Mar  9 14:13:07 2006
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.test.controls.interfacegetter;
+
+import org.apache.beehive.controls.api.bean.ControlExtension;
+
+/**
+ * Control interface for testing property generation from getter/setter methods.
+ */
+@ControlExtension
+public interface CtrlExtension extends ExtCtrl {
+
+    public String getTextExt();
+    public int getCount();
+    public void setCount(int count);
+}

Propchange: beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/CtrlExtension.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/ExtCtrl.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/ExtCtrl.java?rev=384630&view=auto
==============================================================================
--- beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/ExtCtrl.java (added)
+++ beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/ExtCtrl.java Thu Mar  9 14:13:07 2006
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.test.controls.interfacegetter;
+
+import org.apache.beehive.controls.api.bean.ControlInterface;
+
+/**
+ * Control interface for testing property generation from getter/setter methods.
+ */
+@ControlInterface
+public interface ExtCtrl {
+
+    public String getText();
+    public void setText(String text);
+}

Propchange: beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/ExtCtrl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/ExtCtrlImpl.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/ExtCtrlImpl.java?rev=384630&view=auto
==============================================================================
--- beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/ExtCtrlImpl.java (added)
+++ beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/ExtCtrlImpl.java Thu Mar  9 14:13:07 2006
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.test.controls.interfacegetter;
+
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+import org.apache.beehive.controls.api.bean.Extensible;
+
+import java.lang.reflect.Method;
+
+/**
+ * Control implementation for testing getter/setter property generation
+ * from a control interface.
+ */
+@ControlImplementation(isTransient=true)
+public class ExtCtrlImpl implements ExtCtrl, Extensible {
+
+    public String getText() {
+        return null;
+    }
+
+    public void setText(String text) {
+    }
+
+    /**
+     * Called by the Controls runtime to handle calls to methods of an
+     * extensible control.
+     * <p/>
+     *
+     * @param method The extended operation that was called.
+     * @param args   Parameters of the operation.
+     * @return The value that should be returned by the operation.
+     * @throws Throwable any exception declared on the extended operation may be
+     *                   thrown.  If a checked exception is thrown from the implementation that is not declared
+     *                   on the original interface, it will be wrapped in a ControlException.
+     */
+    public Object invoke(Method method, Object[] args) throws Throwable {
+        return null;
+    }
+}

Propchange: beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/ExtCtrlImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/InterfaceGetterSetter.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/InterfaceGetterSetter.java?rev=384630&view=auto
==============================================================================
--- beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/InterfaceGetterSetter.java (added)
+++ beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/InterfaceGetterSetter.java Thu Mar  9 14:13:07 2006
@@ -0,0 +1,33 @@
+/*
+   Copyright 2004-2005 The Apache Software Foundation.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+   
+       http://www.apache.org/licenses/LICENSE-2.0
+   
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+  
+   $Header:$
+*/
+package org.apache.beehive.controls.test.controls.interfacegetter;
+
+import org.apache.beehive.controls.api.bean.ControlInterface;
+
+/**
+ * Control interface for testing property generation from getter/setter methods.
+ */
+@ControlInterface
+public interface InterfaceGetterSetter {
+
+
+    public String getText();
+    public void setText(String text);
+
+    public int getCount();
+}

Propchange: beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/InterfaceGetterSetter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/InterfaceGetterSetterImpl.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/InterfaceGetterSetterImpl.java?rev=384630&view=auto
==============================================================================
--- beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/InterfaceGetterSetterImpl.java (added)
+++ beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/InterfaceGetterSetterImpl.java Thu Mar  9 14:13:07 2006
@@ -0,0 +1,39 @@
+/*
+   Copyright 2004-2005 The Apache Software Foundation.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+   
+       http://www.apache.org/licenses/LICENSE-2.0
+   
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+  
+   $Header:$
+*/
+package org.apache.beehive.controls.test.controls.interfacegetter;
+
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+
+/**
+ * Control implementation for testing getter/setter property generation
+ * from a control interface.
+ */
+@ControlImplementation(isTransient=true)
+public class InterfaceGetterSetterImpl implements InterfaceGetterSetter {
+
+    public String getText() {
+        return null;
+    }
+
+    public void setText(String text) {
+    }
+
+    public int getCount() {
+        return 0;
+    }
+}

Propchange: beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/interfacegetter/InterfaceGetterSetterImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/propertiesoptional/OptionalPropertySet.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/propertiesoptional/OptionalPropertySet.java?rev=384630&r1=384629&r2=384630&view=diff
==============================================================================
--- beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/propertiesoptional/OptionalPropertySet.java (original)
+++ beehive/trunk/controls/test/src/junit-controls/org/apache/beehive/controls/test/controls/propertiesoptional/OptionalPropertySet.java Thu Mar  9 14:13:07 2006
@@ -20,7 +20,6 @@
 
 import org.apache.beehive.controls.api.bean.ControlInterface;
 import org.apache.beehive.controls.api.properties.PropertySet;
-import org.apache.beehive.controls.api.packaging.PropertyInfo;
 
 import java.lang.annotation.Target;
 import java.lang.annotation.ElementType;

Modified: beehive/trunk/controls/test/src/junit-tests/org/apache/beehive/controls/test/junit/PropertyTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/src/junit-tests/org/apache/beehive/controls/test/junit/PropertyTest.java?rev=384630&r1=384629&r2=384630&view=diff
==============================================================================
--- beehive/trunk/controls/test/src/junit-tests/org/apache/beehive/controls/test/junit/PropertyTest.java (original)
+++ beehive/trunk/controls/test/src/junit-tests/org/apache/beehive/controls/test/junit/PropertyTest.java Thu Mar  9 14:13:07 2006
@@ -30,6 +30,10 @@
 import org.apache.beehive.controls.test.controls.propertiessimple.PropertyBean;
 import org.apache.beehive.controls.test.controls.propertiesoptional.OptionalPropertySet;
 import org.apache.beehive.controls.test.controls.propertiesoptional.OptionalPropertySetBean;
+import org.apache.beehive.controls.test.controls.interfacegetter.InterfaceGetterSetter;
+import org.apache.beehive.controls.test.controls.interfacegetter.InterfaceGetterSetterBean;
+import org.apache.beehive.controls.test.controls.interfacegetter.CtrlExtension;
+import org.apache.beehive.controls.test.controls.interfacegetter.CtrlExtensionBean;
 
 /**
  *
@@ -44,6 +48,12 @@
     @Control
     private OptionalPropertySetBean _optionalControl;
 
+    @Control
+    private InterfaceGetterSetterBean _getterSetterControl;
+
+    @Control
+    private CtrlExtensionBean _ctrlExtensionControl;
+
     private boolean _eventHandlerCalled = false;
 
     public void testDeclarativePropertyInstantiation() {
@@ -75,9 +85,7 @@
      * @throws Exception
      */
     public void testOptionalPropertySet() throws Exception {
-        OptionalPropertySet property = (OptionalPropertySet)instantiateControl(OptionalPropertySetBean.class.getName());
-        OptionalPropertySetBean propertyBean = (OptionalPropertySetBean)property;
-        BeanInfo bi = Introspector.getBeanInfo(propertyBean.getClass());
+        BeanInfo bi = Introspector.getBeanInfo(_optionalControl.getClass());
         PropertyDescriptor[] pds = bi.getPropertyDescriptors();
 
         // There should not be a PropertyDescriptor for a property set which has optional=true and hasSetters=false
@@ -87,5 +95,51 @@
         assertEquals("value", pds[1].getName());
         assertNull(pds[1].getReadMethod());
         assertNotNull(pds[1].getWriteMethod());
+    }
+
+    /**
+     * Verify that the generated BeanInfo class contains property descriptors for getters/setters declared in
+     * a control interface.
+     *
+     * @throws Exception
+     */
+    public void testGetterSetterPropertyGeneration() throws Exception {
+        BeanInfo bi = Introspector.getBeanInfo(_getterSetterControl.getClass());
+        PropertyDescriptor[] pds = bi.getPropertyDescriptors();
+
+        assertEquals(3, pds.length);
+
+        assertEquals("count", pds[1].getName());
+        assertNotNull(pds[1].getReadMethod());
+        assertNull(pds[1].getWriteMethod());
+
+        assertEquals("text", pds[2].getName());
+        assertNotNull(pds[2].getReadMethod());
+        assertNotNull(pds[2].getWriteMethod());
+    }
+
+    /**
+     * Verify that the generated BeanInfo class contains property descriptors for getters/setters declared in
+     * a control interface for an extensible control.
+     *
+     * @throws Exception
+     */
+    public void testGetterSetterExtPropertyGeneration() throws Exception {
+        BeanInfo bi = Introspector.getBeanInfo(_ctrlExtensionControl.getClass());
+        PropertyDescriptor[] pds = bi.getPropertyDescriptors();
+
+        assertEquals(4, pds.length);
+
+        assertEquals("count", pds[1].getName());
+        assertNotNull(pds[1].getReadMethod());
+        assertNotNull(pds[1].getWriteMethod());
+
+        assertEquals("text", pds[2].getName());
+        assertNotNull(pds[2].getReadMethod());
+        assertNotNull(pds[2].getWriteMethod());
+
+        assertEquals("textExt", pds[3].getName());
+        assertNotNull(pds[3].getReadMethod());
+        assertNull(pds[3].getWriteMethod());
     }
 }