You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ke...@apache.org on 2004/07/30 12:41:40 UTC

svn commit: rev 30984 - in incubator/beehive/trunk/controls: drt/controls/org/apache/beehive/controls/test/properties drt/tests/org/apache/beehive/controls/test/properties src/api/org/apache/beehive/controls/api/properties src/runtime/org/apache/beehive/controls/runtime/generator/apt

Author: kentam
Date: Fri Jul 30 03:41:38 2004
New Revision: 30984

Modified:
   incubator/beehive/trunk/controls/drt/controls/org/apache/beehive/controls/test/properties/Props.java
   incubator/beehive/trunk/controls/drt/tests/org/apache/beehive/controls/test/properties/PropTest.java
   incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/properties/PropertySet.java
   incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptControlInterface.java
Log:
Add test for @PropertySet( prefix="foo" ) and update javabvdocs.



Modified: incubator/beehive/trunk/controls/drt/controls/org/apache/beehive/controls/test/properties/Props.java
==============================================================================
--- incubator/beehive/trunk/controls/drt/controls/org/apache/beehive/controls/test/properties/Props.java	(original)
+++ incubator/beehive/trunk/controls/drt/controls/org/apache/beehive/controls/test/properties/Props.java	Fri Jul 30 03:41:38 2004
@@ -54,9 +54,9 @@
     static final SimpleEnum [] ARRAY_ENUM_DEFAULT = { SimpleEnum.ChoiceB, SimpleEnum.ChoiceC };
 
     //
-    // Define a PropertySet that tests array types
+    // Define a PropertySet that tests array types and prefixed getter/setters
     //
-    @PropertySet
+    @PropertySet( prefix="Arrays" )
     @Retention(RetentionPolicy.RUNTIME) 
     @Target( {ElementType.TYPE, ElementType.FIELD} )
     public @interface ArrayProps

Modified: incubator/beehive/trunk/controls/drt/tests/org/apache/beehive/controls/test/properties/PropTest.java
==============================================================================
--- incubator/beehive/trunk/controls/drt/tests/org/apache/beehive/controls/test/properties/PropTest.java	(original)
+++ incubator/beehive/trunk/controls/drt/tests/org/apache/beehive/controls/test/properties/PropTest.java	Fri Jul 30 03:41:38 2004
@@ -108,15 +108,15 @@
         //
         // int [] property test
         //
-        int [] arrayInt = propBean.getArrayInt();
+        int [] arrayInt = propBean.getArraysArrayInt();
         if (arrayInt == null || arrayInt.length != Props.ARRAY_INT_DEFAULT.length)
             throw new Exception("bad default for int:" + arrayInt);
         for (int i = 0; i < arrayInt.length; i++)
             if (arrayInt[i] != Props.ARRAY_INT_DEFAULT[i])
                 throw new Exception("bad default for int[" + i + "]:" + arrayInt[i]);
         int [] testArrayInt = {1, 2, 3, 4, 5};
-        propBean.setArrayInt(testArrayInt);
-        arrayInt = propBean.getArrayInt();
+        propBean.setArraysArrayInt(testArrayInt);
+        arrayInt = propBean.getArraysArrayInt();
         if (arrayInt == null || arrayInt.length != testArrayInt.length)
             throw new Exception("bad get size for arrayInt:" + arrayInt);
         for (int i = 0; i < arrayInt.length; i++)
@@ -126,15 +126,15 @@
         //
         // String [] property test
         //
-        String [] arrayString = propBean.getArrayString();
+        String [] arrayString = propBean.getArraysArrayString();
         if (arrayString == null || arrayString.length != Props.ARRAY_STRING_DEFAULT.length)
             throw new Exception("bad default for String []:" + arrayString);
         for (int i = 0; i < arrayString.length; i++)
             if (!arrayString[i].equals(Props.ARRAY_STRING_DEFAULT[i]))
                 throw new Exception("bad default for String []:" + arrayString);
         String [] testArrayString = { "fee", "fi", "fo", "fum" };
-        propBean.setArrayString(testArrayString);
-        arrayString = propBean.getArrayString();
+        propBean.setArraysArrayString(testArrayString);
+        arrayString = propBean.getArraysArrayString();
         if (arrayString.length != testArrayString.length)
             throw new Exception("bad get size for String array:" + arrayString);
         for (int i = 0; i < arrayString.length; i++)
@@ -144,7 +144,7 @@
         //
         // Class [] property test
         //
-        Class [] arrayClass = propBean.getArrayClass();
+        Class [] arrayClass = propBean.getArraysArrayClass();
         if (arrayClass == null || arrayClass.length != Props.ARRAY_CLASS_DEFAULT.length)
             throw new Exception("bad default for Class []:" + arrayClass);
         for (int i = 0; i < arrayClass.length; i++)
@@ -152,8 +152,8 @@
                 throw new Exception("bad default for Class []:" + arrayClass);
         Class [] testArrayClass = {Integer.class, Long.class, Short.class, Float.class,
                                    Double.class, Character.class, Boolean.class};
-        propBean.setArrayClass(testArrayClass);
-        arrayClass = propBean.getArrayClass();
+        propBean.setArraysArrayClass(testArrayClass);
+        arrayClass = propBean.getArraysArrayClass();
         if (arrayClass.length != testArrayClass.length)
             throw new Exception("bad get size for Class array:" + arrayClass);
         for (int i = 0; i < arrayClass.length; i++)
@@ -163,7 +163,7 @@
         //
         // Enum [] property test
         //
-        SimpleEnum [] arrayEnum = propBean.getArrayEnum();
+        SimpleEnum [] arrayEnum = propBean.getArraysArrayEnum();
         if (arrayEnum == null || arrayEnum.length != Props.ARRAY_ENUM_DEFAULT.length)
             throw new Exception("bad default for Class []:" + arrayEnum);
         for (int i = 0; i < arrayEnum.length; i++)
@@ -171,8 +171,8 @@
                 throw new Exception("bad default for Class []:" + arrayEnum);
         SimpleEnum [] testArrayEnum = 
             { SimpleEnum.ChoiceB, SimpleEnum.ChoiceC, SimpleEnum.ChoiceA };
-        propBean.setArrayEnum(testArrayEnum);
-        arrayEnum = propBean.getArrayEnum();
+        propBean.setArraysArrayEnum(testArrayEnum);
+        arrayEnum = propBean.getArraysArrayEnum();
         if (arrayEnum.length != testArrayEnum.length)
             throw new Exception("bad get size for Class array:" + arrayEnum);
         for (int i = 0; i < arrayEnum.length; i++)

Modified: incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/properties/PropertySet.java
==============================================================================
--- incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/properties/PropertySet.java	(original)
+++ incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/properties/PropertySet.java	Fri Jul 30 03:41:38 2004
@@ -55,7 +55,9 @@
 {
     /**
      * The prefix member defines a prefix that will be used in all property setter/getter
-     * methods for properties in the <code>PropertySet</code>.
+     * methods for properties in the <code>PropertySet</code>.  It is necessary to specify
+     * a prefixes when a control interface has multiple property sets that contain
+     * properties with the same name.
      * <p>
      * The following code shows the basic conventions for setter/getter methods on a Java
      * Control Bean:

Modified: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptControlInterface.java
==============================================================================
--- incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptControlInterface.java	(original)
+++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/AptControlInterface.java	Fri Jul 30 03:41:38 2004
@@ -161,6 +161,9 @@
     {
         ArrayList<ControlPropertySet> propSets = new ArrayList<ControlPropertySet>();
 
+        // TODO: enforce presence of prefixes when multiple property sets w/ the same
+        // property name exist
+
         for (TypeDeclaration innerDecl : _intfDecl.getNestedTypes())
         {
             // HACKHACK: There appear to be mirror API bugs where calling getAnnotation()