Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 30978 invoked from network); 13 Jun 2006 05:14:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 13 Jun 2006 05:14:46 -0000 Received: (qmail 17286 invoked by uid 500); 13 Jun 2006 05:14:46 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 17237 invoked by uid 500); 13 Jun 2006 05:14:45 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 17224 invoked by uid 99); 13 Jun 2006 05:14:45 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Jun 2006 22:14:45 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Jun 2006 22:14:44 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 1C6981A983A; Mon, 12 Jun 2006 22:14:24 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r413811 - in /incubator/harmony/enhanced/classlib/trunk/modules/beans: make/common/ src/main/java/java/beans/ src/test/java/org/apache/harmony/beans/tests/java/beans/ Date: Tue, 13 Jun 2006 05:14:23 -0000 To: harmony-commits@incubator.apache.org From: ndbeyer@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060613051424.1C6981A983A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: ndbeyer Date: Mon Jun 12 22:14:22 2006 New Revision: 413811 URL: http://svn.apache.org/viewvc?rev=413811&view=rev Log: Rework to match specification and enable more tests. Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/make/common/build.xml incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanDescriptor.java incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/FeatureDescriptor.java incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/MethodDescriptor.java incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/FeatureDescriptorTest.java incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MethodDescriptorTest.java Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/make/common/build.xml URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/make/common/build.xml?rev=413811&r1=413810&r2=413811&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/make/common/build.xml (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/make/common/build.xml Mon Jun 12 22:14:22 2006 @@ -158,7 +158,6 @@ - @@ -166,10 +165,10 @@ - + - + Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanDescriptor.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanDescriptor.java?rev=413811&r1=413810&r2=413811&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanDescriptor.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanDescriptor.java Mon Jun 12 22:14:22 2006 @@ -1,41 +1,44 @@ /* - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * 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. + * Copyright 2005 The Apache Software Foundation or its licensors, as + * applicable. + * + * 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. */ -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.4.6.3 $ - */ package java.beans; /** + * Describes a bean's global information. + * * @author Maxim V. Berkultsev - * @version $Revision: 1.4.6.3 $ */ - public class BeanDescriptor extends FeatureDescriptor { - - private Class beanClass; - private Class customizerClass; + private Class beanClass; + + private Class customizerClass; /** - * @com.intel.drl.spec_ref + *

+ * Constructs an instance with the bean's {@link Class} and a customizer + * {@link Class}. The descriptor's {@link #getName()} is set as the + * unqualified name of the beanClass. + *

+ * + * @param beanClass The bean's Class. + * @param customizerClass The bean's customizer Class. */ public BeanDescriptor(Class beanClass, Class customizerClass) { super(); - if (beanClass == null) { throw new NullPointerException(); } @@ -45,7 +48,13 @@ } /** - * @com.intel.drl.spec_ref + *

+ * Constructs an instance with the bean's {@link Class}. The descriptor's + * {@link #getName()} is set as the unqualified name of the + * beanClass. + *

+ * + * @param beanClass The bean's Class. */ public BeanDescriptor(Class beanClass) { super(); @@ -58,29 +67,45 @@ } /** - * @com.intel.drl.spec_ref + *

+ * Gets the bean's customizer {@link Class}/ + *

+ * + * @return A {@link Class} instance or null. */ public Class getCustomizerClass() { return customizerClass; } /** - * @com.intel.drl.spec_ref + *

+ * Gets the bean's {@link Class}. + *

+ * + * @return A {@link Class} instance. */ public Class getBeanClass() { return beanClass; } - - private String getShortClassName(Class beanClass) { + + /** + *

+ * Utility method for getting the unqualified name of a {@link Class}. + *

+ * + * @param beanClass The Class to get the name from. + * @return A String instance or null. + */ + private String getShortClassName(Class beanClass) { String result = null; - - if(beanClass != null) { + + if (beanClass != null) { String beanClassName = beanClass.getName(); int idx = beanClassName.lastIndexOf("."); - result = (idx == -1) ? beanClassName : beanClassName.substring(idx - + 1); + result = (idx == -1) ? beanClassName : beanClassName + .substring(idx + 1); } - + return result; } Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/FeatureDescriptor.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/FeatureDescriptor.java?rev=413811&r1=413810&r2=413811&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/FeatureDescriptor.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/FeatureDescriptor.java Mon Jun 12 22:14:22 2006 @@ -1,62 +1,73 @@ /* - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * 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. - */ - -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.4.6.3 $ + * Copyright 2005 The Apache Software Foundation or its licensors, as + * applicable. + * + * 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. */ package java.beans; +import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; -import java.util.Vector; +import java.util.Map; /** + * Common base class for Descriptors. + * * @author Maxim V. Berkultsev - * @version $Revision: 1.4.6.3 $ */ - public class FeatureDescriptor { - - private HashMap values = new HashMap(); + + private Map values; + boolean preferred, hidden, expert; - String shortDescription = null; - String name = null; - String displayName = null; + + String shortDescription; + + String name; + + String displayName; /** - * @com.intel.drl.spec_ref + *

+ * Constructs an instance. + *

*/ public FeatureDescriptor() { - this.preferred = false; - this.hidden = false; - this.expert = false; + this.values = new HashMap(); } /** - * @com.intel.drl.spec_ref + *

+ * Sets the value for the named attribute. + *

+ * + * @param attributeName The name of the attribute to set a value with. + * @param value The value to set. */ public void setValue(String attributeName, Object value) { - if ((attributeName != null) && (value != null)) { - values.put(attributeName, value); - } + if (attributeName == null || value == null) + throw new NullPointerException(); + values.put(attributeName, value); } /** - * @com.intel.drl.spec_ref + *

+ * Gets the value associated with the named attribute. + *

+ * + * @param attributeName The name of the attribute to get a value for. + * @return The attribute's value. */ public Object getValue(String attributeName) { Object result = null; @@ -67,93 +78,146 @@ } /** - * @com.intel.drl.spec_ref + *

+ * Enumerates the attribute names. + *

+ * + * @return An instance of {@link Enumeration}. */ public Enumeration attributeNames() { - Vector attribNames = new Vector(values.size()); - attribNames.addAll(values.keySet()); - return attribNames.elements(); + return Collections.enumeration(values.keySet()); } /** - * @com.intel.drl.spec_ref + *

+ * Sets the short description. + *

+ * + * @param text The description to set. */ public void setShortDescription(String text) { this.shortDescription = text; } /** - * @com.intel.drl.spec_ref + *

+ * Sets the name. + *

+ * + * @param name The name to set. */ public void setName(String name) { this.name = name; } /** - * @com.intel.drl.spec_ref + *

+ * Sets the display name. + *

+ * + * @param displayName The display name to set. */ public void setDisplayName(String displayName) { this.displayName = displayName; } /** - * @com.intel.drl.spec_ref + *

+ * Gets the short description or {@link #getDisplayName()} if not set. + *

+ * + * @return The description. */ public String getShortDescription() { - return shortDescription; + return shortDescription == null ? getDisplayName() : shortDescription; } /** - * @com.intel.drl.spec_ref + *

+ * Gets the name. + *

+ * + * @return The name. */ public String getName() { return name; } /** - * @com.intel.drl.spec_ref + *

+ * Gets the display name or {@link #getName()} if not set. + *

+ * + * @return The display name. */ public String getDisplayName() { - return displayName; + return displayName == null ? getName() : displayName; } /** - * @com.intel.drl.spec_ref + *

+ * Sets the preferred indicator. + *

+ * + * @param preferred true if preferred, false + * otherwise. */ public void setPreferred(boolean preferred) { this.preferred = preferred; } /** - * @com.intel.drl.spec_ref + *

+ * Sets the hidden indicator. + *

+ * + * @param hidden true if hidden, false + * otherwise. */ public void setHidden(boolean hidden) { this.hidden = hidden; } /** - * @com.intel.drl.spec_ref + *

+ * Sets the expert indicator. + *

+ * + * @param expert true if expert, false + * otherwise. */ public void setExpert(boolean expert) { this.expert = expert; } /** - * @com.intel.drl.spec_ref + *

+ * Indicates if this feature is preferred. + *

+ * + * @return true if preferred, false otherwise. */ public boolean isPreferred() { return preferred; } /** - * @com.intel.drl.spec_ref + *

+ * Indicates if this feature is hidden. + *

+ * + * @return true if hidden, false otherwise. */ public boolean isHidden() { return hidden; } /** - * @com.intel.drl.spec_ref + *

+ * Indicates if this feature is an expert feature. + *

+ * + * @return true if hidden, false otherwise. */ public boolean isExpert() { return expert; Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/MethodDescriptor.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/MethodDescriptor.java?rev=413811&r1=413810&r2=413811&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/MethodDescriptor.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/MethodDescriptor.java Mon Jun 12 22:14:22 2006 @@ -1,44 +1,49 @@ /* - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * 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. + * Copyright 2005 The Apache Software Foundation or its licensors, as + * applicable. + * + * 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. */ -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.5.4.3 $ - */ package java.beans; import java.lang.reflect.Method; /** + * Describes a bean's method. + * * @author Maxim V. Berkultsev - * @version $Revision: 1.5.4.3 $ */ - public class MethodDescriptor extends FeatureDescriptor { - + private Method method; + private ParameterDescriptor[] parameterDescriptors; /** - * @com.intel.drl.spec_ref + *

+ * Constructs an instance with the given {@link Method} and + * {@link ParameterDescriptor}s. The {@link #getName()} is set as the name + * of the method passed. + *

+ * + * @param method The Method to set. + * @param parameterDescriptors An array of parameter descriptors. */ public MethodDescriptor(Method method, ParameterDescriptor[] parameterDescriptors) { super(); - + if (method == null) { throw new NullPointerException(); } @@ -46,34 +51,46 @@ this.parameterDescriptors = parameterDescriptors; setName(method.getName()); - setDisplayName(method.getName()); } /** - * @com.intel.drl.spec_ref + *

+ * Constructs an instance with the given {@link Method}. The + * {@link #getName()} is set as the name of the method + * passed. + *

+ * + * @param method The Method to set. */ public MethodDescriptor(Method method) { super(); - + if (method == null) { throw new NullPointerException(); } this.method = method; - this.parameterDescriptors = new ParameterDescriptor[0]; setName(method.getName()); - setDisplayName(method.getName()); } /** - * @com.intel.drl.spec_ref + *

+ * Gets the method. + *

+ * + * @return A {@link Method} instance. */ public Method getMethod() { return method; } /** - * @com.intel.drl.spec_ref + *

+ * Gets the parameter descriptors. + *

+ * + * @return An array of {@link ParameterDescriptor} instance or + * null. */ public ParameterDescriptor[] getParameterDescriptors() { return parameterDescriptors; Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/FeatureDescriptorTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/FeatureDescriptorTest.java?rev=413811&r1=413810&r2=413811&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/FeatureDescriptorTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/FeatureDescriptorTest.java Mon Jun 12 22:14:22 2006 @@ -264,8 +264,8 @@ for (int i = 0; i < attributeNames.length; i++) { fd.setValue(attributeNames[i], values[i]); } - Enumeration names = fd.attributeNames(); - Hashtable table = new Hashtable(); + Enumeration names = fd.attributeNames(); + Hashtable table = new Hashtable(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); table.put(name, fd.getValue(name)); Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MethodDescriptorTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MethodDescriptorTest.java?rev=413811&r1=413810&r2=413811&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MethodDescriptorTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MethodDescriptorTest.java Mon Jun 12 22:14:22 2006 @@ -67,7 +67,7 @@ public void testMethodDescriptorMethod_Null() { Method method = null; try { - MethodDescriptor md = new MethodDescriptor(method); + new MethodDescriptor(method); fail("Should throw NullPointerException."); } catch (NullPointerException e) { } @@ -109,7 +109,7 @@ ParameterDescriptor[] pds = new ParameterDescriptor[1]; pds[0] = new ParameterDescriptor(); try { - MethodDescriptor md = new MethodDescriptor(method, pds); + new MethodDescriptor(method, pds); fail("Should throw NullPointerException."); } catch (NullPointerException e) { }