Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 34847 invoked from network); 28 Sep 2006 12:14:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Sep 2006 12:14:26 -0000 Received: (qmail 24866 invoked by uid 500); 28 Sep 2006 12:14:26 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 24768 invoked by uid 500); 28 Sep 2006 12:14:26 -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 24750 invoked by uid 99); 28 Sep 2006 12:14:25 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Sep 2006 05:14:25 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=5.0 tests=ALL_TRUSTED,NO_REAL_NAME Received: from [140.211.166.113] ([140.211.166.113:51842] helo=eris.apache.org) by idunn.apache.osuosl.org (ecelerity 2.1.1.8 r(12930)) with ESMTP id F2/D0-05478-C8CBB154 for ; Thu, 28 Sep 2006 05:14:05 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 392081A981F; Thu, 28 Sep 2006 05:13:28 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r450827 [2/3] - in /incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans: ./ beancontext/ Date: Thu, 28 Sep 2006 12:13:26 -0000 To: harmony-commits@incubator.apache.org From: tellison@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20060928121328.392081A981F@eris.apache.org> X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/IndexedPropertyDescriptor.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/IndexedPropertyDescriptor.java?view=diff&rev=450827&r1=450826&r2=450827 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/IndexedPropertyDescriptor.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/IndexedPropertyDescriptor.java Thu Sep 28 05:13:24 2006 @@ -14,10 +14,6 @@ * limitations under the License. */ -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.5.6.3 $ - */ package java.beans; import java.lang.reflect.Method; @@ -25,168 +21,126 @@ import org.apache.harmony.beans.internal.nls.Messages; -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.5.6.3 $ - */ - public class IndexedPropertyDescriptor extends PropertyDescriptor { - + private Method indexedGetter = null; + private Method indexedSetter = null; - /** - * @com.intel.drl.spec_ref - */ - public IndexedPropertyDescriptor( - String propertyName, - Class beanClass, - String getterName, - String setterName, - String indexedGetterName, + public IndexedPropertyDescriptor(String propertyName, Class beanClass, + String getterName, String setterName, String indexedGetterName, String indexedSetterName) throws IntrospectionException { + super(propertyName, beanClass, getterName, setterName); setIndexedReadMethod(beanClass, indexedGetterName); setIndexedWriteMethod(beanClass, indexedSetterName); } - /** - * @com.intel.drl.spec_ref - */ - public IndexedPropertyDescriptor( - String propertyName, - Method getter, - Method setter, - Method indexedGetter, - Method indexedSetter) throws IntrospectionException { + public IndexedPropertyDescriptor(String propertyName, Method getter, + Method setter, Method indexedGetter, Method indexedSetter) + throws IntrospectionException { + super(propertyName, getter, setter); setIndexedReadMethod(indexedGetter); setIndexedWriteMethod(indexedGetter); } - /** - * @com.intel.drl.spec_ref - */ public IndexedPropertyDescriptor(String propertyName, Class beanClass) throws IntrospectionException { - super(propertyName, beanClass); - + + super(propertyName, beanClass); String indexedGetterName = createDefaultMethodName(propertyName, "get"); //$NON-NLS-1$ - if(hasMethod(beanClass, indexedGetterName)) { + if (hasMethod(beanClass, indexedGetterName)) { setIndexedReadMethod(beanClass, indexedGetterName); } else { - throw new IntrospectionException(Messages.getString("beans.1F", propertyName)); //$NON-NLS-1$ + throw new IntrospectionException(Messages.getString( + "beans.1F", propertyName)); //$NON-NLS-1$ } - + String indexedSetterName = createDefaultMethodName(propertyName, "set"); //$NON-NLS-1$ - if(hasMethod(beanClass, indexedSetterName)) { + if (hasMethod(beanClass, indexedSetterName)) { setIndexedWriteMethod(beanClass, indexedSetterName); } else { - throw new IntrospectionException(Messages.getString("beans.20", propertyName)); //$NON-NLS-1$ + throw new IntrospectionException(Messages.getString( + "beans.20", propertyName)); //$NON-NLS-1$ } } - /** - * @com.intel.drl.spec_ref - */ public void setIndexedReadMethod(Method indexedGetter) throws IntrospectionException { if (indexedGetter != null) { int modifiers = indexedGetter.getModifiers(); if (!Modifier.isPublic(modifiers)) { - throw new IntrospectionException( - Messages.getString("beans.21")); //$NON-NLS-1$ + throw new IntrospectionException(Messages.getString("beans.21")); //$NON-NLS-1$ } - + Class[] parameterTypes = indexedGetter.getParameterTypes(); if (parameterTypes.length != 1) { - throw new IntrospectionException( - Messages.getString("beans.22")); //$NON-NLS-1$ + throw new IntrospectionException(Messages.getString("beans.22")); //$NON-NLS-1$ } - + if (!parameterTypes[0].equals(int.class)) { - throw new IntrospectionException( - Messages.getString("beans.23")); //$NON-NLS-1$ + throw new IntrospectionException(Messages.getString("beans.23")); //$NON-NLS-1$ } - + Class returnType = indexedGetter.getReturnType(); Class indexedPropertyType = getIndexedPropertyType(); - if((indexedPropertyType != null) && !returnType.equals( - indexedPropertyType)) { - throw new IntrospectionException( - Messages.getString("beans.24")); //$NON-NLS-1$ + if ((indexedPropertyType != null) + && !returnType.equals(indexedPropertyType)) { + throw new IntrospectionException(Messages.getString("beans.24")); //$NON-NLS-1$ } } - + this.indexedGetter = indexedGetter; } - /** - * @com.intel.drl.spec_ref - */ public void setIndexedWriteMethod(Method indexedSetter) throws IntrospectionException { if (indexedSetter != null) { int modifiers = indexedSetter.getModifiers(); if (!Modifier.isPublic(modifiers)) { - throw new IntrospectionException( - Messages.getString("beans.25")); //$NON-NLS-1$ + throw new IntrospectionException(Messages.getString("beans.25")); //$NON-NLS-1$ } - + Class[] parameterTypes = indexedSetter.getParameterTypes(); if (parameterTypes.length != 2) { - throw new IntrospectionException( - Messages.getString("beans.26")); //$NON-NLS-1$ + throw new IntrospectionException(Messages.getString("beans.26")); //$NON-NLS-1$ } - + Class firstParameterType = parameterTypes[0]; if (!firstParameterType.equals(int.class)) { - throw new IntrospectionException( - Messages.getString("beans.27")); //$NON-NLS-1$ - } - + throw new IntrospectionException(Messages.getString("beans.27")); //$NON-NLS-1$ + } + Class secondParameterType = parameterTypes[1]; if (!secondParameterType.equals(getIndexedPropertyType())) { - throw new IntrospectionException( - Messages.getString("beans.28")); //$NON-NLS-1$ + throw new IntrospectionException(Messages.getString("beans.28")); //$NON-NLS-1$ } } - + this.indexedSetter = indexedSetter; } - /** - * @com.intel.drl.spec_ref - */ public Method getIndexedWriteMethod() { return indexedSetter; } - /** - * @com.intel.drl.spec_ref - */ public Method getIndexedReadMethod() { return indexedGetter; } - /** - * @com.intel.drl.spec_ref - */ + @Override public boolean equals(Object obj) { boolean result = super.equals(obj); - if(result) { + if (result) { IndexedPropertyDescriptor pd = (IndexedPropertyDescriptor) obj; - result = - (this.indexedGetter.equals(pd.getIndexedReadMethod())) && - (this.indexedSetter.equals(pd.getIndexedWriteMethod())); + result = (this.indexedGetter.equals(pd.getIndexedReadMethod())) + && (this.indexedSetter.equals(pd.getIndexedWriteMethod())); return result; } return result; } - /** - * @com.intel.drl.spec_ref - */ public Class getIndexedPropertyType() { Class result = null; if (indexedGetter != null) { @@ -195,32 +149,38 @@ Class[] parameterTypes = indexedSetter.getParameterTypes(); result = parameterTypes[1]; } - return result; + return result; } - + private void setIndexedReadMethod(Class beanClass, String indexedGetterName) { Method[] getters = findMethods(beanClass, indexedGetterName); boolean result = false; - for (int i = 0; i < getters.length; ++i) { + for (Method element : getters) { try { - setIndexedReadMethod(getters[i]); + setIndexedReadMethod(element); result = true; - } catch (IntrospectionException ie) {} - if (result) break; + } catch (IntrospectionException ie) { + } + if (result) { + break; + } } } - + private void setIndexedWriteMethod(Class beanClass, String indexedSetterName) { Method[] setters = findMethods(beanClass, indexedSetterName); boolean result = false; - for (int i = 0; i < setters.length; ++i) { + for (Method element : setters) { try { - setIndexedWriteMethod(setters[i]); + setIndexedWriteMethod(element); result = true; - } catch (IntrospectionException ie) {} - if (result) break; + } catch (IntrospectionException ie) { + } + if (result) { + break; + } } } } Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/IntrospectionException.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/IntrospectionException.java?view=diff&rev=450827&r1=450826&r2=450827 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/IntrospectionException.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/IntrospectionException.java Thu Sep 28 05:13:24 2006 @@ -14,24 +14,12 @@ * limitations under the License. */ -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.2.6.3 $ - */ package java.beans; -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.2.6.3 $ - */ - public class IntrospectionException extends Exception { static final long serialVersionUID = -3728150539969542619L; - /** - * @com.intel.drl.spec_ref - */ public IntrospectionException(String message) { super(message); } Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Introspector.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Introspector.java?view=diff&rev=450827&r1=450826&r2=450827 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Introspector.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Introspector.java Thu Sep 28 05:13:24 2006 @@ -16,16 +16,12 @@ package java.beans; -import java.util.HashMap; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -/** - * @author Maxim V. Berkultsev - * @version $Revision$ - */ public class Introspector { public static final int USE_ALL_BEANINFO = 1; @@ -33,67 +29,52 @@ public static final int IGNORE_IMMEDIATE_BEANINFO = 2; public static final int IGNORE_ALL_BEANINFO = 3; - - private Introspector() {} - /** - * @com.intel.drl.spec_ref - */ + private Introspector() { + } + public static String decapitalize(String name) { - if((name != null) && (name.length() > 0)) { + if ((name != null) && (name.length() > 0)) { // first two letters are capital - if((name.length() > 1) && name.substring(0,2).equals( - name.substring(0,2).toUpperCase())) { + if ((name.length() > 1) + && name.substring(0, 2).equals( + name.substring(0, 2).toUpperCase())) { return name; } - String result = name.substring(0,1).toLowerCase(); - if(name.length() > 1) { + String result = name.substring(0, 1).toLowerCase(); + if (name.length() > 1) { result += name.substring(1); } return result; - } + } return name; } - /** - * @com.intel.drl.spec_ref - */ public static BeanInfo getBeanInfo(Class beanClass, int flags) - throws IntrospectionException - { + throws IntrospectionException { switch (flags) { case USE_ALL_BEANINFO: - return getBeanInfo(beanClass, null, false, false); + return getBeanInfo(beanClass, null, false, false); case IGNORE_IMMEDIATE_BEANINFO: return getBeanInfo(beanClass, null, true, false); case IGNORE_ALL_BEANINFO: return getBeanInfo(beanClass, null, true, true); default: - //TODO: verify that default beahvior complies with RI + // TODO: verify that default beahvior complies with RI return getBeanInfo(beanClass, null, false, false); } } - /** - * @com.intel.drl.spec_ref - */ public static BeanInfo getBeanInfo(Class beanClass) throws IntrospectionException { - return getBeanInfo(beanClass, null, false, false); + return getBeanInfo(beanClass, null, false, false); } - - /** - * @com.intel.drl.spec_ref - */ + public static BeanInfo getBeanInfo(Class beanClass, Class stopClass) - throws IntrospectionException - { + throws IntrospectionException { return getBeanInfo(beanClass, stopClass, false, false); } - /** - * @com.intel.drl.spec_ref - */ public static synchronized void setBeanInfoSearchPath(String[] searchPath) { if (searchPath != null) { SecurityManager sm = System.getSecurityManager(); @@ -104,32 +85,23 @@ } } - /** - * @com.intel.drl.spec_ref - */ public static synchronized String[] getBeanInfoSearchPath() { return path; } - /** - * @com.intel.drl.spec_ref - */ public static void flushFromCaches(Class clz) { removeBeanInfoClassFromCache(clz); } - /** - * @com.intel.drl.spec_ref - */ public static void flushCaches() { removeAllBeanInfoClassesFromCache(); } // private methods - private static BeanInfoWrapper getBeanInfo(Class beanClass, Class stopClass, - boolean ignoreBeanClassBeanInfo, boolean ignoreSuperClassBeanInfo) - { + private static BeanInfoWrapper getBeanInfo(Class beanClass, + Class stopClass, boolean ignoreBeanClassBeanInfo, + boolean ignoreSuperClassBeanInfo) { if (beanClass == null) { throw new java.lang.NullPointerException(); } @@ -142,41 +114,41 @@ } // find bean info as a separate class - + BeanInfo beanInfo = null; if (!ignoreBeanClassBeanInfo) { try { Class beanInfoClass = findBeanInfoClass(beanClass); - if(beanInfoClass != null) { + if (beanInfoClass != null) { beanInfo = (BeanInfo) beanInfoClass.newInstance(); } } catch (Exception e) { } } - - //... - + + // ... + // generate bean info automatically - + BeanInfoImpl beanInfoImpl = new BeanInfoImpl(beanClass); - - //... - + + // ... + BeanInfoWrapper wrapper = new BeanInfoWrapper(beanInfo, beanInfoImpl); - + Class parent = beanClass.getSuperclass(); if ((parent != null) && (parent != stopClass)) { BeanInfoWrapper parentBeanInfo = getBeanInfo(parent, stopClass, - ignoreSuperClassBeanInfo, ignoreSuperClassBeanInfo); - + ignoreSuperClassBeanInfo, ignoreSuperClassBeanInfo); + wrapper.merge(parentBeanInfo); } - - //... - + + // ... + storeBeanInfoClassInCache(wrapper, beanClass, stopClass, - ignoreBeanClassBeanInfo, ignoreSuperClassBeanInfo); - + ignoreBeanClassBeanInfo, ignoreSuperClassBeanInfo); + return wrapper; } @@ -184,18 +156,19 @@ String beanClassName = beanClass.getName(); int idx = beanClassName.lastIndexOf("."); //$NON-NLS-1$ String shortBeanInfoClassName = beanClassName.substring(idx + 1, - beanClassName.length()) + "BeanInfo"; //$NON-NLS-1$ + beanClassName.length()) + + "BeanInfo"; //$NON-NLS-1$ String fullBeanInfoClassName = beanClassName + "BeanInfo"; //$NON-NLS-1$ Class beanInfoClass = null; try { - beanInfoClass = Class.forName( - fullBeanInfoClassName, true, beanClass.getClassLoader()); - + beanInfoClass = Class.forName(fullBeanInfoClassName, true, + beanClass.getClassLoader()); + } catch (ClassNotFoundException cnfe) { - for (int i = 0; i < path.length; ++i) { + for (String element : path) { try { - fullBeanInfoClassName = path[i] + "." //$NON-NLS-1$ + fullBeanInfoClassName = element + "." //$NON-NLS-1$ + shortBeanInfoClassName; beanInfoClass = Class.forName(fullBeanInfoClassName, true, beanClass.getClassLoader()); @@ -204,48 +177,43 @@ } } } - + return beanInfoClass; } - private static BeanInfoWrapper findBeanInfoClassInCache( - Class beanClass, - Class stopClass, - boolean ignoreBeanClassBeanInfo, + private static BeanInfoWrapper findBeanInfoClassInCache(Class beanClass, + Class stopClass, boolean ignoreBeanClassBeanInfo, boolean ignoreSuperClassBeanInfo) { BeanInfoWrapper result = null; List beanInfoDatas = beanInfos.get(beanClass.getName()); if (beanInfoDatas != null) { Iterator iterator = beanInfoDatas.iterator(); - while(iterator.hasNext()) { - BeanInfoData beanInfoData = (BeanInfoData) iterator.next(); - if ((beanInfoData.getStopClass() == stopClass) && - (beanInfoData.getIgnoreBeanClassBeanInfo() - == ignoreBeanClassBeanInfo) - && (beanInfoData.getIgnoreSuperClassBeanInfo() - == ignoreSuperClassBeanInfo)) - { + while (iterator.hasNext()) { + BeanInfoData beanInfoData = iterator.next(); + if ((beanInfoData.getStopClass() == stopClass) + && (beanInfoData.getIgnoreBeanClassBeanInfo() == ignoreBeanClassBeanInfo) + && (beanInfoData.getIgnoreSuperClassBeanInfo() == ignoreSuperClassBeanInfo)) { result = beanInfoData.getBeanInfoWrapper(); } - if (result != null) break; + if (result != null) { + break; + } } } return result; } - + private static void storeBeanInfoClassInCache( - BeanInfoWrapper beanInfoWrapper, - Class beanClass, - Class stopClass, - boolean ignoreBeanClassBeanInfo, + BeanInfoWrapper beanInfoWrapper, Class beanClass, + Class stopClass, boolean ignoreBeanClassBeanInfo, boolean ignoreSuperClassBeanInfo) { List beanInfoDatas = beanInfos.get(beanClass.getName()); - if(beanInfoDatas == null) { + if (beanInfoDatas == null) { beanInfoDatas = new ArrayList(); beanInfos.put(beanClass.getName(), beanInfoDatas); } beanInfoDatas.add(new BeanInfoData(stopClass, ignoreBeanClassBeanInfo, - ignoreSuperClassBeanInfo, beanInfoWrapper)); + ignoreSuperClassBeanInfo, beanInfoWrapper)); } private static void removeBeanInfoClassFromCache(Class beanClass) { @@ -258,8 +226,8 @@ // private fields - private static String[] path = {"org.apache.harmony.beans.infos"}; //$NON-NLS-1$ - private static Map> beanInfos = - new HashMap>(); + private static String[] path = { "org.apache.harmony.beans.infos" }; //$NON-NLS-1$ + + private static Map> beanInfos = new HashMap>(); } 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?view=diff&rev=450827&r1=450826&r2=450827 ============================================================================== --- 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 Thu Sep 28 05:13:24 2006 @@ -21,8 +21,6 @@ /** * Describes a bean's method. - * - * @author Maxim V. Berkultsev */ public class MethodDescriptor extends FeatureDescriptor { @@ -37,8 +35,10 @@ * of the method passed. *

* - * @param method The Method to set. - * @param parameterDescriptors An array of parameter descriptors. + * @param method + * The Method to set. + * @param parameterDescriptors + * An array of parameter descriptors. */ public MethodDescriptor(Method method, ParameterDescriptor[] parameterDescriptors) { @@ -60,7 +60,8 @@ * passed. *

* - * @param method The Method to set. + * @param method + * The Method to set. */ public MethodDescriptor(Method method) { super(); Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/ParameterDescriptor.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/ParameterDescriptor.java?view=diff&rev=450827&r1=450826&r2=450827 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/ParameterDescriptor.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/ParameterDescriptor.java Thu Sep 28 05:13:24 2006 @@ -14,22 +14,10 @@ * limitations under the License. */ -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.2.6.3 $ - */ package java.beans; -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.2.6.3 $ - */ - public class ParameterDescriptor extends FeatureDescriptor { - /** - * @com.intel.drl.spec_ref - */ public ParameterDescriptor() { } } Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PersistenceDelegate.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PersistenceDelegate.java?view=diff&rev=450827&r1=450826&r2=450827 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PersistenceDelegate.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PersistenceDelegate.java Thu Sep 28 05:13:24 2006 @@ -14,33 +14,18 @@ * limitations under the License. */ -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.10.6.3 $ - */ package java.beans; -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.10.6.3 $ - */ - public abstract class PersistenceDelegate { - /** - * @com.intel.drl.spec_ref - */ public PersistenceDelegate() { } - - /** - * @com.intel.drl.spec_ref - */ - protected void initialize( - Class type, Object oldInstance, Object newInstance, Encoder out) { + + protected void initialize(Class type, Object oldInstance, + Object newInstance, Encoder out) { if ((out != null) && (type != null)) { - PersistenceDelegate pd = out.getPersistenceDelegate( - type.getSuperclass()); + PersistenceDelegate pd = out.getPersistenceDelegate(type + .getSuperclass()); if (pd != null) { pd.initialize(type, oldInstance, newInstance, out); @@ -48,46 +33,35 @@ } } - /** - * @com.intel.drl.spec_ref - */ protected abstract Expression instantiate(Object oldInstance, Encoder out); - /** - * @com.intel.drl.spec_ref - */ protected boolean mutatesTo(Object oldInstance, Object newInstance) { boolean bothInstancesAreNull = (oldInstance == null) && (newInstance == null); - + if (bothInstancesAreNull) { return false; - } else { - return (oldInstance != null) && (newInstance != null) ? - oldInstance.getClass() == newInstance.getClass() : false; } + return (oldInstance != null) && (newInstance != null) ? oldInstance + .getClass() == newInstance.getClass() : false; } - /** - * @com.intel.drl.spec_ref - */ public void writeObject(Object oldInstance, Encoder out) { - // nulls are covered by NullPersistenceDelegate assert oldInstance != null; Object newInstance = out.get(oldInstance); - + if (mutatesTo(oldInstance, newInstance)) { - initialize(oldInstance.getClass(), oldInstance, newInstance, out); + initialize(oldInstance.getClass(), oldInstance, newInstance, out); } else { - if (newInstance != null) { - out.remove(newInstance); - } - - out.writeExpression(instantiate(oldInstance, out)); - newInstance = out.get(oldInstance); - initialize(oldInstance.getClass(), oldInstance, newInstance, out); + if (newInstance != null) { + out.remove(newInstance); + } + + out.writeExpression(instantiate(oldInstance, out)); + newInstance = out.get(oldInstance); + initialize(oldInstance.getClass(), oldInstance, newInstance, out); } } } Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeEvent.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeEvent.java?view=diff&rev=450827&r1=450826&r2=450827 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeEvent.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeEvent.java Thu Sep 28 05:13:24 2006 @@ -14,71 +14,47 @@ * limitations under the License. */ -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.4.6.3 $ - */ package java.beans; import java.util.EventObject; -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.4.6.3 $ - */ - public class PropertyChangeEvent extends EventObject { - + private static final long serialVersionUID = 7042693688939648123L; - + String propertyName; + Object oldValue; + Object newValue; + Object propagationId; - - /** - * @com.intel.drl.spec_ref - */ + public PropertyChangeEvent(Object source, String propertyName, Object oldValue, Object newValue) { super(source); - + this.propertyName = propertyName; this.oldValue = oldValue; this.newValue = newValue; } - /** - * @com.intel.drl.spec_ref - */ public String getPropertyName() { return propertyName; } - /** - * @com.intel.drl.spec_ref - */ public void setPropagationId(Object propagationId) { this.propagationId = propagationId; } - /** - * @com.intel.drl.spec_ref - */ public Object getPropagationId() { return propagationId; } - /** - * @com.intel.drl.spec_ref - */ public Object getOldValue() { return oldValue; } - /** - * @com.intel.drl.spec_ref - */ public Object getNewValue() { return newValue; } Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeListener.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeListener.java?view=diff&rev=450827&r1=450826&r2=450827 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeListener.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeListener.java Thu Sep 28 05:13:24 2006 @@ -14,23 +14,11 @@ * limitations under the License. */ -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.2.6.3 $ - */ package java.beans; import java.util.EventListener; -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.2.6.3 $ - */ - public interface PropertyChangeListener extends EventListener { - /** - * @com.intel.drl.spec_ref - */ public void propertyChange(PropertyChangeEvent event); } Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeListenerProxy.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeListenerProxy.java?view=diff&rev=450827&r1=450826&r2=450827 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeListenerProxy.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeListenerProxy.java Thu Sep 28 05:13:24 2006 @@ -14,46 +14,27 @@ * limitations under the License. */ -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.3.6.3 $ - */ package java.beans; import java.util.EventListenerProxy; -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.3.6.3 $ - */ - -public class PropertyChangeListenerProxy extends EventListenerProxy - implements PropertyChangeListener { - +public class PropertyChangeListenerProxy extends EventListenerProxy implements + PropertyChangeListener { + String propertyName; - /** - * @com.intel.drl.spec_ref - */ public PropertyChangeListenerProxy(String propertyName, PropertyChangeListener listener) { super(listener); this.propertyName = propertyName; } - /** - * @com.intel.drl.spec_ref - */ public String getPropertyName() { return propertyName; } - /** - * @com.intel.drl.spec_ref - */ public void propertyChange(PropertyChangeEvent event) { - PropertyChangeListener listener = - (PropertyChangeListener) getListener(); + PropertyChangeListener listener = (PropertyChangeListener) getListener(); listener.propertyChange(event); } } Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeSupport.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeSupport.java?view=diff&rev=450827&r1=450826&r2=450827 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeSupport.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeSupport.java Thu Sep 28 05:13:24 2006 @@ -14,9 +14,6 @@ * limitations under the License. */ -/** - * @author Maxim V. Berkultsev - */ package java.beans; import java.io.IOException; @@ -30,398 +27,327 @@ import java.util.List; import java.util.Map; -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.13.2.4 $ - */ public class PropertyChangeSupport implements Serializable { - private static final long serialVersionUID = 6401253773779951803l; + private static final long serialVersionUID = 6401253773779951803l; - private transient Object sourceBean; + private transient Object sourceBean; - private transient List allPropertiesChangeListeners = - new ArrayList(); + private transient List allPropertiesChangeListeners = new ArrayList(); - private transient Map> selectedPropertiesChangeListeners = - new HashMap>(); - - // fields for serialization compatibility - private Hashtable> children; - - private Object source; - - private int propertyChangeSupportSerializedDataVersion = 1; - - /** - * @com.intel.drl.spec_ref - */ - public PropertyChangeSupport(Object sourceBean) { - if (sourceBean == null) { - throw new NullPointerException(); - } - this.sourceBean = sourceBean; - } - - /** - * @com.intel.drl.spec_ref - */ - public void firePropertyChange(String propertyName, Object oldValue, - Object newValue) { - PropertyChangeEvent event = createPropertyChangeEvent(propertyName, - oldValue, newValue); - doFirePropertyChange(event); - } - - /** - * TODO - * - * @param propertyName - * @param index - * @param oldValue - * @param newValue - */ - public void fireIndexedPropertyChange(String propertyName, int index, - Object oldValue, Object newValue) { - - // nulls and equals check done in doFire... - doFirePropertyChange(new IndexedPropertyChangeEvent(source, - propertyName, oldValue, newValue, index)); - } - - /** - * @com.intel.drl.spec_ref - */ - public synchronized void removePropertyChangeListener(String propertyName, - PropertyChangeListener listener) { - if ((propertyName != null) && (listener != null)) { - List listeners = selectedPropertiesChangeListeners - .get(propertyName); - - if (listeners != null) { - listeners.remove(listener); - } - } - } - - /** - * @com.intel.drl.spec_ref - */ - public synchronized void addPropertyChangeListener(String propertyName, - PropertyChangeListener listener) { - if ((listener != null) && (propertyName != null)) { - List listeners = selectedPropertiesChangeListeners - .get(propertyName); - - if (listeners == null) { - listeners = new ArrayList(); - selectedPropertiesChangeListeners.put(propertyName, listeners); - } - - listeners.add(listener); - } - } - - /** - * @com.intel.drl.spec_ref - */ - public synchronized PropertyChangeListener[] getPropertyChangeListeners( - String propertyName) { - List listeners = null; - - if (propertyName != null) { - listeners = selectedPropertiesChangeListeners.get(propertyName); - } - - return (listeners == null) ? new PropertyChangeListener[] {} - : getAsPropertyChangeListenerArray(listeners); - - } - - /** - * @com.intel.drl.spec_ref - */ - public void firePropertyChange(String propertyName, boolean oldValue, - boolean newValue) { - PropertyChangeEvent event = createPropertyChangeEvent(propertyName, - oldValue, newValue); - doFirePropertyChange(event); - } - - /** - * TODO - * - * @param propertyName - * @param index - * @param oldValue - * @param newValue - */ - public void fireIndexedPropertyChange(String propertyName, int index, - boolean oldValue, boolean newValue) { - - if (oldValue != newValue) { - fireIndexedPropertyChange(propertyName, index, Boolean - .valueOf(oldValue), Boolean.valueOf(newValue)); - } - } - - /** - * @com.intel.drl.spec_ref - */ - public void firePropertyChange(String propertyName, int oldValue, - int newValue) { - PropertyChangeEvent event = createPropertyChangeEvent(propertyName, - oldValue, newValue); - doFirePropertyChange(event); - } - - /** - * TODO - * - * @param propertyName - * @param index - * @param oldValue - * @param newValue - */ - public void fireIndexedPropertyChange(String propertyName, int index, - int oldValue, int newValue) { - - if (oldValue != newValue) { - fireIndexedPropertyChange(propertyName, index, - new Integer(oldValue), new Integer(newValue)); - } - } - - /** - * @com.intel.drl.spec_ref - */ - public synchronized boolean hasListeners(String propertyName) { - boolean result = allPropertiesChangeListeners.size() > 0; - if (!result && (propertyName != null)) { - List listeners = selectedPropertiesChangeListeners - .get(propertyName); - if (listeners != null) { - result = listeners.size() > 0; - } - } - return result; - } - - /** - * @com.intel.drl.spec_ref - */ - public synchronized void removePropertyChangeListener( - PropertyChangeListener listener) { - if (listener != null) { - if (listener instanceof PropertyChangeListenerProxy) { - String name = ((PropertyChangeListenerProxy) listener) - .getPropertyName(); - PropertyChangeListener lst = (PropertyChangeListener) ((PropertyChangeListenerProxy) listener) - .getListener(); - - removePropertyChangeListener(name, lst); - } else { - allPropertiesChangeListeners.remove(listener); - } - } - } - - /** - * @com.intel.drl.spec_ref - */ - public synchronized void addPropertyChangeListener( - PropertyChangeListener listener) { - if (listener != null) { - if (listener instanceof PropertyChangeListenerProxy) { - String name = ((PropertyChangeListenerProxy) listener) - .getPropertyName(); - PropertyChangeListener lst = (PropertyChangeListener) ((PropertyChangeListenerProxy) listener) - .getListener(); - addPropertyChangeListener(name, lst); - } else { - allPropertiesChangeListeners.add(listener); - } - - } - } - - /** - * @com.intel.drl.spec_ref - */ - public synchronized PropertyChangeListener[] getPropertyChangeListeners() { - ArrayList result = new ArrayList( - allPropertiesChangeListeners); - - Iterator keysIterator = selectedPropertiesChangeListeners - .keySet().iterator(); - while (keysIterator.hasNext()) { - String propertyName = keysIterator.next(); - - List selectedListeners = selectedPropertiesChangeListeners - .get(propertyName); - if (selectedListeners != null) { - - Iterator i = selectedListeners - .iterator(); - while (i.hasNext()) { - PropertyChangeListener listener = i.next(); - result.add(new PropertyChangeListenerProxy(propertyName, - listener)); - } - - } - - } - - return getAsPropertyChangeListenerArray(result); - } - - /** - * @com.intel.drl.spec_ref - */ - private void writeObject(ObjectOutputStream oos) throws IOException { - List allSerializedPropertiesChangeListeners = - new ArrayList(); - Iterator i = allPropertiesChangeListeners.iterator(); - while (i.hasNext()) { - PropertyChangeListener pcl = (PropertyChangeListener) i.next(); - if (pcl instanceof Serializable) { - allSerializedPropertiesChangeListeners.add(pcl); - } - } - - Map> selectedSerializedPropertiesChangeListeners = - new HashMap>(); - Iterator keyIterator = selectedPropertiesChangeListeners - .keySet().iterator(); - while (keyIterator.hasNext()) { - String propertyName = keyIterator.next(); - List keyValues = selectedPropertiesChangeListeners - .get(propertyName); - if (keyValues != null) { - List serializedPropertiesChangeListeners = - new ArrayList(); - - Iterator j = keyValues.iterator(); - while (j.hasNext()) { - PropertyChangeListener pcl = j.next(); - if (pcl instanceof Serializable) { - serializedPropertiesChangeListeners.add(pcl); - } - } - - if (!serializedPropertiesChangeListeners.isEmpty()) { - selectedSerializedPropertiesChangeListeners.put( - propertyName, serializedPropertiesChangeListeners); - } - - } - } - - children = new Hashtable>( - selectedSerializedPropertiesChangeListeners); - children.put("", allSerializedPropertiesChangeListeners); //$NON-NLS-1$ - oos.writeObject(children); - - Object source = null; - if (sourceBean instanceof Serializable) { - source = sourceBean; - } - oos.writeObject(source); - - oos.writeInt(propertyChangeSupportSerializedDataVersion); - } - - /** - * @com.intel.drl.spec_ref - */ - private void readObject(ObjectInputStream ois) throws IOException, - ClassNotFoundException { - children = (Hashtable>)ois - .readObject(); - - selectedPropertiesChangeListeners = new HashMap>( - children); - allPropertiesChangeListeners = selectedPropertiesChangeListeners - .remove(""); //$NON-NLS-1$ - if (allPropertiesChangeListeners == null) { - allPropertiesChangeListeners = new ArrayList(); - } - - sourceBean = ois.readObject(); - propertyChangeSupportSerializedDataVersion = ois.readInt(); - } - - /** - * @com.intel.drl.spec_ref - */ - public void firePropertyChange(PropertyChangeEvent event) { - doFirePropertyChange(event); - } - - private PropertyChangeEvent createPropertyChangeEvent(String propertyName, - Object oldValue, Object newValue) { - return new PropertyChangeEvent(sourceBean, propertyName, oldValue, - newValue); - } - - private PropertyChangeEvent createPropertyChangeEvent(String propertyName, - boolean oldValue, boolean newValue) { - return new PropertyChangeEvent(sourceBean, propertyName, new Boolean( - oldValue), new Boolean(newValue)); - } - - private PropertyChangeEvent createPropertyChangeEvent(String propertyName, - int oldValue, int newValue) { - return new PropertyChangeEvent(sourceBean, propertyName, new Integer( - oldValue), new Integer(newValue)); - } - - private void doFirePropertyChange(PropertyChangeEvent event) { - String propertyName = event.getPropertyName(); - Object oldValue = event.getOldValue(); - Object newValue = event.getNewValue(); - - if ((newValue != null) && (oldValue != null) && newValue.equals(oldValue)) { - return; - } - - /* Copy the listeners collections so they can be modified while we fire events. */ - - PropertyChangeListener[] listensToAll; // Listeners to all property change events - PropertyChangeListener[] listensToOne = null; // Listens to a given property change - synchronized(this) { - listensToAll = allPropertiesChangeListeners.toArray( - new PropertyChangeListener[allPropertiesChangeListeners.size()]); - - List listeners = - selectedPropertiesChangeListeners.get(propertyName); - if (listeners != null) { - listensToOne = listeners.toArray( - new PropertyChangeListener[listeners.size()]); - } - } - - // Fire the listeners - for (PropertyChangeListener listener : listensToAll) { - listener.propertyChange(event); - } - if (listensToOne != null) { - for (PropertyChangeListener listener : listensToOne) { - listener.propertyChange(event); - } - } - } - - private static PropertyChangeListener[] getAsPropertyChangeListenerArray( - List listeners) { - Object[] objects = listeners.toArray(); - PropertyChangeListener[] arrayResult = new PropertyChangeListener[objects.length]; - - for (int i = 0; i < objects.length; ++i) { - arrayResult[i] = (PropertyChangeListener) objects[i]; - } + private transient Map> selectedPropertiesChangeListeners = new HashMap>(); - return arrayResult; - } + // fields for serialization compatibility + private Hashtable> children; + + private Object source; + + private int propertyChangeSupportSerializedDataVersion = 1; + + public PropertyChangeSupport(Object sourceBean) { + if (sourceBean == null) { + throw new NullPointerException(); + } + this.sourceBean = sourceBean; + } + + public void firePropertyChange(String propertyName, Object oldValue, + Object newValue) { + PropertyChangeEvent event = createPropertyChangeEvent(propertyName, + oldValue, newValue); + doFirePropertyChange(event); + } + + public void fireIndexedPropertyChange(String propertyName, int index, + Object oldValue, Object newValue) { + + // nulls and equals check done in doFire... + doFirePropertyChange(new IndexedPropertyChangeEvent(source, + propertyName, oldValue, newValue, index)); + } + + public synchronized void removePropertyChangeListener(String propertyName, + PropertyChangeListener listener) { + if ((propertyName != null) && (listener != null)) { + List listeners = selectedPropertiesChangeListeners + .get(propertyName); + + if (listeners != null) { + listeners.remove(listener); + } + } + } + + public synchronized void addPropertyChangeListener(String propertyName, + PropertyChangeListener listener) { + if ((listener != null) && (propertyName != null)) { + List listeners = selectedPropertiesChangeListeners + .get(propertyName); + + if (listeners == null) { + listeners = new ArrayList(); + selectedPropertiesChangeListeners.put(propertyName, listeners); + } + + listeners.add(listener); + } + } + + public synchronized PropertyChangeListener[] getPropertyChangeListeners( + String propertyName) { + List listeners = null; + + if (propertyName != null) { + listeners = selectedPropertiesChangeListeners.get(propertyName); + } + + return (listeners == null) ? new PropertyChangeListener[] {} + : getAsPropertyChangeListenerArray(listeners); + } + + public void firePropertyChange(String propertyName, boolean oldValue, + boolean newValue) { + PropertyChangeEvent event = createPropertyChangeEvent(propertyName, + oldValue, newValue); + doFirePropertyChange(event); + } + + public void fireIndexedPropertyChange(String propertyName, int index, + boolean oldValue, boolean newValue) { + + if (oldValue != newValue) { + fireIndexedPropertyChange(propertyName, index, Boolean + .valueOf(oldValue), Boolean.valueOf(newValue)); + } + } + + public void firePropertyChange(String propertyName, int oldValue, + int newValue) { + PropertyChangeEvent event = createPropertyChangeEvent(propertyName, + oldValue, newValue); + doFirePropertyChange(event); + } + + public void fireIndexedPropertyChange(String propertyName, int index, + int oldValue, int newValue) { + + if (oldValue != newValue) { + fireIndexedPropertyChange(propertyName, index, + new Integer(oldValue), new Integer(newValue)); + } + } + + public synchronized boolean hasListeners(String propertyName) { + boolean result = allPropertiesChangeListeners.size() > 0; + if (!result && (propertyName != null)) { + List listeners = selectedPropertiesChangeListeners + .get(propertyName); + if (listeners != null) { + result = listeners.size() > 0; + } + } + return result; + } + + public synchronized void removePropertyChangeListener( + PropertyChangeListener listener) { + if (listener != null) { + if (listener instanceof PropertyChangeListenerProxy) { + String name = ((PropertyChangeListenerProxy) listener) + .getPropertyName(); + PropertyChangeListener lst = (PropertyChangeListener) ((PropertyChangeListenerProxy) listener) + .getListener(); + + removePropertyChangeListener(name, lst); + } else { + allPropertiesChangeListeners.remove(listener); + } + } + } + + public synchronized void addPropertyChangeListener( + PropertyChangeListener listener) { + if (listener != null) { + if (listener instanceof PropertyChangeListenerProxy) { + String name = ((PropertyChangeListenerProxy) listener) + .getPropertyName(); + PropertyChangeListener lst = (PropertyChangeListener) ((PropertyChangeListenerProxy) listener) + .getListener(); + addPropertyChangeListener(name, lst); + } else { + allPropertiesChangeListeners.add(listener); + } + } + } + + public synchronized PropertyChangeListener[] getPropertyChangeListeners() { + ArrayList result = new ArrayList( + allPropertiesChangeListeners); + + Iterator keysIterator = selectedPropertiesChangeListeners + .keySet().iterator(); + while (keysIterator.hasNext()) { + String propertyName = keysIterator.next(); + + List selectedListeners = selectedPropertiesChangeListeners + .get(propertyName); + if (selectedListeners != null) { + + Iterator i = selectedListeners + .iterator(); + while (i.hasNext()) { + PropertyChangeListener listener = i.next(); + result.add(new PropertyChangeListenerProxy(propertyName, + listener)); + } + } + } + + return getAsPropertyChangeListenerArray(result); + } + + private void writeObject(ObjectOutputStream oos) throws IOException { + List allSerializedPropertiesChangeListeners = new ArrayList(); + Iterator i = allPropertiesChangeListeners + .iterator(); + while (i.hasNext()) { + PropertyChangeListener pcl = i.next(); + if (pcl instanceof Serializable) { + allSerializedPropertiesChangeListeners.add(pcl); + } + } + + Map> selectedSerializedPropertiesChangeListeners = new HashMap>(); + Iterator keyIterator = selectedPropertiesChangeListeners + .keySet().iterator(); + while (keyIterator.hasNext()) { + String propertyName = keyIterator.next(); + List keyValues = selectedPropertiesChangeListeners + .get(propertyName); + if (keyValues != null) { + List serializedPropertiesChangeListeners = new ArrayList(); + + Iterator j = keyValues.iterator(); + while (j.hasNext()) { + PropertyChangeListener pcl = j.next(); + if (pcl instanceof Serializable) { + serializedPropertiesChangeListeners.add(pcl); + } + } + + if (!serializedPropertiesChangeListeners.isEmpty()) { + selectedSerializedPropertiesChangeListeners.put( + propertyName, serializedPropertiesChangeListeners); + } + } + } + + children = new Hashtable>( + selectedSerializedPropertiesChangeListeners); + children.put("", allSerializedPropertiesChangeListeners); //$NON-NLS-1$ + oos.writeObject(children); + + Object source = null; + if (sourceBean instanceof Serializable) { + source = sourceBean; + } + oos.writeObject(source); + + oos.writeInt(propertyChangeSupportSerializedDataVersion); + } + + @SuppressWarnings("unchecked") + private void readObject(ObjectInputStream ois) throws IOException, + ClassNotFoundException { + children = (Hashtable>) ois + .readObject(); + + selectedPropertiesChangeListeners = new HashMap>( + children); + allPropertiesChangeListeners = selectedPropertiesChangeListeners + .remove(""); //$NON-NLS-1$ + if (allPropertiesChangeListeners == null) { + allPropertiesChangeListeners = new ArrayList(); + } + + sourceBean = ois.readObject(); + propertyChangeSupportSerializedDataVersion = ois.readInt(); + } + + public void firePropertyChange(PropertyChangeEvent event) { + doFirePropertyChange(event); + } + + private PropertyChangeEvent createPropertyChangeEvent(String propertyName, + Object oldValue, Object newValue) { + return new PropertyChangeEvent(sourceBean, propertyName, oldValue, + newValue); + } + + private PropertyChangeEvent createPropertyChangeEvent(String propertyName, + boolean oldValue, boolean newValue) { + return new PropertyChangeEvent(sourceBean, propertyName, new Boolean( + oldValue), new Boolean(newValue)); + } + + private PropertyChangeEvent createPropertyChangeEvent(String propertyName, + int oldValue, int newValue) { + return new PropertyChangeEvent(sourceBean, propertyName, new Integer( + oldValue), new Integer(newValue)); + } + + private void doFirePropertyChange(PropertyChangeEvent event) { + String propertyName = event.getPropertyName(); + Object oldValue = event.getOldValue(); + Object newValue = event.getNewValue(); + + if ((newValue != null) && (oldValue != null) + && newValue.equals(oldValue)) { + return; + } + + /* + * Copy the listeners collections so they can be modified while we fire + * events. + */ + + // Listeners to all property change events + PropertyChangeListener[] listensToAll; + // Listens to a given property change + PropertyChangeListener[] listensToOne = null; + synchronized (this) { + listensToAll = allPropertiesChangeListeners + .toArray(new PropertyChangeListener[allPropertiesChangeListeners + .size()]); + + List listeners = selectedPropertiesChangeListeners + .get(propertyName); + if (listeners != null) { + listensToOne = listeners + .toArray(new PropertyChangeListener[listeners.size()]); + } + } + + // Fire the listeners + for (PropertyChangeListener listener : listensToAll) { + listener.propertyChange(event); + } + if (listensToOne != null) { + for (PropertyChangeListener listener : listensToOne) { + listener.propertyChange(event); + } + } + } + + private static PropertyChangeListener[] getAsPropertyChangeListenerArray( + List listeners) { + Object[] objects = listeners.toArray(); + PropertyChangeListener[] arrayResult = new PropertyChangeListener[objects.length]; + + for (int i = 0; i < objects.length; ++i) { + arrayResult[i] = (PropertyChangeListener) objects[i]; + } + + return arrayResult; + } } Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyDescriptor.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyDescriptor.java?view=diff&rev=450827&r1=450826&r2=450827 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyDescriptor.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyDescriptor.java Thu Sep 28 05:13:24 2006 @@ -16,9 +16,9 @@ package java.beans; +import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import java.lang.reflect.Constructor; import java.util.Vector; import org.apache.harmony.beans.internal.nls.Messages; @@ -26,14 +26,17 @@ public class PropertyDescriptor extends FeatureDescriptor { Class beanClass = null; + String propertyName = null; - + Method getter = null; + Method setter = null; - + Class propertyEditorClass = null; - + boolean constrained = false; + boolean bound = false; public PropertyDescriptor(String propertyName, Class beanClass, @@ -96,51 +99,48 @@ } this.propertyName = propertyName; - + this.setName(propertyName); this.setDisplayName(propertyName); - + String getterName = createDefaultMethodName(propertyName, "is"); //$NON-NLS-1$ - if(hasMethod(beanClass, getterName)) { + if (hasMethod(beanClass, getterName)) { setReadMethod(beanClass, getterName); } else { getterName = createDefaultMethodName(propertyName, "get"); //$NON-NLS-1$ - if(hasMethod(beanClass, getterName)) { + if (hasMethod(beanClass, getterName)) { setReadMethod(beanClass, getterName); } else { throw new IntrospectionException(Messages.getString("beans.1F")); //$NON-NLS-1$ } } String setterName = createDefaultMethodName(propertyName, "set"); //$NON-NLS-1$ - if(hasMethod(beanClass, setterName)) { + if (hasMethod(beanClass, setterName)) { setWriteMethod(beanClass, setterName); } else { throw new IntrospectionException(Messages.getString("beans.20")); //$NON-NLS-1$ } } - + public void setWriteMethod(Method setter) throws IntrospectionException { if (setter != null) { int modifiers = setter.getModifiers(); if (!Modifier.isPublic(modifiers)) { - throw new IntrospectionException( - Messages.getString("beans.05")); //$NON-NLS-1$ + throw new IntrospectionException(Messages.getString("beans.05")); //$NON-NLS-1$ } - + Class[] parameterTypes = setter.getParameterTypes(); if (parameterTypes.length != 1) { - throw new IntrospectionException( - Messages.getString("beans.06")); //$NON-NLS-1$ + throw new IntrospectionException(Messages.getString("beans.06")); //$NON-NLS-1$ } - + Class parameterType = parameterTypes[0]; Class propertyType = getPropertyType(); - if(propertyType != null && !propertyType.equals(parameterType)) { - throw new IntrospectionException( - Messages.getString("beans.07")); //$NON-NLS-1$ + if (propertyType != null && !propertyType.equals(parameterType)) { + throw new IntrospectionException(Messages.getString("beans.07")); //$NON-NLS-1$ } } - + this.setter = setter; } @@ -148,27 +148,24 @@ if (getter != null) { int modifiers = getter.getModifiers(); if (!Modifier.isPublic(modifiers)) { - throw new IntrospectionException( - Messages.getString("beans.0A")); //$NON-NLS-1$ + throw new IntrospectionException(Messages.getString("beans.0A")); //$NON-NLS-1$ } - + Class[] parameterTypes = getter.getParameterTypes(); if (parameterTypes.length != 0) { - throw new IntrospectionException( - Messages.getString("beans.08")); //$NON-NLS-1$ + throw new IntrospectionException(Messages.getString("beans.08")); //$NON-NLS-1$ } - + Class returnType = getter.getReturnType(); if (returnType.equals(Void.TYPE)) { throw new IntrospectionException(Messages.getString("beans.33")); //$NON-NLS-1$ } Class propertyType = getPropertyType(); - if((propertyType != null) && !returnType.equals(propertyType)) { - throw new IntrospectionException( - Messages.getString("beans.09")); //$NON-NLS-1$ + if ((propertyType != null) && !returnType.equals(propertyType)) { + throw new IntrospectionException(Messages.getString("beans.09")); //$NON-NLS-1$ } } - + this.getter = getter; } @@ -180,34 +177,32 @@ return getter; } + @Override public boolean equals(Object object) { boolean result = (object != null); if (result) { PropertyDescriptor pd = (PropertyDescriptor) object; - + boolean gettersAreEqual = (this.getter == null) && (pd.getReadMethod() == null) || (this.getter != null) && (this.getter.equals(pd.getReadMethod())); - + boolean settersAreEqual = (this.setter == null) && (pd.getWriteMethod() == null) || (this.setter != null) && (this.setter.equals(pd.getWriteMethod())); - - boolean propertyTypesAreEqual = - this.getPropertyType() == pd.getPropertyType(); - boolean propertyEditorClassesAreEqual = - this.getPropertyEditorClass() == pd.getPropertyEditorClass(); + + boolean propertyTypesAreEqual = this.getPropertyType() == pd + .getPropertyType(); + boolean propertyEditorClassesAreEqual = this + .getPropertyEditorClass() == pd.getPropertyEditorClass(); boolean boundPropertyAreEqual = this.isBound() == pd.isBound(); - boolean constrainedPropertyAreEqual = - this.isConstrained() == pd.isConstrained(); - - result = gettersAreEqual - && settersAreEqual - && propertyTypesAreEqual - && propertyEditorClassesAreEqual - && boundPropertyAreEqual - && constrainedPropertyAreEqual; - }; + boolean constrainedPropertyAreEqual = this.isConstrained() == pd + .isConstrained(); + + result = gettersAreEqual && settersAreEqual + && propertyTypesAreEqual && propertyEditorClassesAreEqual + && boundPropertyAreEqual && constrainedPropertyAreEqual; + } return result; } @@ -245,12 +240,12 @@ public boolean isBound() { return bound; } - + boolean hasMethod(Class beanClass, String methodName) { Method[] methods = findMethods(beanClass, methodName); return (methods.length > 0); } - + String createDefaultMethodName(String propertyName, String prefix) { String result = null; if (propertyName != null) { @@ -260,36 +255,35 @@ } return result; } - + Method[] findMethods(Class aClass, String methodName) { Method[] allMethods = aClass.getMethods(); Vector matchedMethods = new Vector(); - for (int i = 0; i < allMethods.length; ++i) { - Method method = allMethods[i]; + for (Method method : allMethods) { if (method.getName().equals(methodName)) { matchedMethods.add(method); } } - + Method[] result = new Method[matchedMethods.size()]; - for(int j = 0; j < matchedMethods.size(); ++j) { - result[j] = (Method) matchedMethods.elementAt(j); + for (int j = 0; j < matchedMethods.size(); ++j) { + result[j] = matchedMethods.elementAt(j); } return result; } - + private void setReadMethod(Class beanClass, String getterName) { boolean result = false; - + Method[] getters = findMethods(beanClass, getterName); - - for (int i = 0; i < getters.length; ++i) { + + for (Method element : getters) { try { - setReadMethod(getters[i]); + setReadMethod(element); result = true; } catch (IntrospectionException ie) { } - + if (result) { break; } @@ -299,22 +293,22 @@ private void setWriteMethod(Class beanClass, String setterName) throws IntrospectionException { boolean result = false; - + Method[] setters = findMethods(beanClass, setterName); - - for (int i = 0; i < setters.length; ++i) { + + for (Method element : setters) { try { - setWriteMethod(setters[i]); + setWriteMethod(element); result = true; } catch (IntrospectionException ie) { } - + if (result) { break; } } } - + public PropertyEditor createPropertyEditor(Object bean) { PropertyEditor editor; @@ -323,7 +317,8 @@ } if (!PropertyEditor.class.isAssignableFrom(propertyEditorClass)) { - // beans.48=Property editor is not assignable from the PropertyEditor interface + // beans.48=Property editor is not assignable from the + // PropertyEditor interface throw new ClassCastException(Messages.getString("beans.48")); //$NON-NLS-1$ } @@ -341,8 +336,8 @@ } } catch (Exception e) { // beans.47=Unable to instantiate property editor - RuntimeException re = new RuntimeException( - Messages.getString("beans.47"), e); //$NON-NLS-1$ + RuntimeException re = new RuntimeException(Messages + .getString("beans.47"), e); //$NON-NLS-1$ throw re; } Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyEditor.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyEditor.java?view=diff&rev=450827&r1=450826&r2=450827 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyEditor.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyEditor.java Thu Sep 28 05:13:24 2006 @@ -14,80 +14,35 @@ * limitations under the License. */ -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.3.6.3 $ - */ package java.beans; import java.awt.Component; import java.awt.Graphics; import java.awt.Rectangle; -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.3.6.3 $ - */ - public interface PropertyEditor { - /** - * @com.intel.drl.spec_ref - */ public void paintValue(Graphics gfx, Rectangle box); - /** - * @com.intel.drl.spec_ref - */ public void setAsText(String text) throws IllegalArgumentException; - /** - * @com.intel.drl.spec_ref - */ public String[] getTags(); - /** - * @com.intel.drl.spec_ref - */ public String getJavaInitializationString(); - /** - * @com.intel.drl.spec_ref - */ public String getAsText(); - /** - * @com.intel.drl.spec_ref - */ public void setValue(Object value); - /** - * @com.intel.drl.spec_ref - */ public Object getValue(); - /** - * @com.intel.drl.spec_ref - */ public void removePropertyChangeListener(PropertyChangeListener listener); - /** - * @com.intel.drl.spec_ref - */ public void addPropertyChangeListener(PropertyChangeListener listener); - /** - * @com.intel.drl.spec_ref - */ public Component getCustomEditor(); - /** - * @com.intel.drl.spec_ref - */ public boolean supportsCustomEditor(); - /** - * @com.intel.drl.spec_ref - */ public boolean isPaintable(); } Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyEditorManager.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyEditorManager.java?view=diff&rev=450827&r1=450826&r2=450827 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyEditorManager.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyEditorManager.java Thu Sep 28 05:13:24 2006 @@ -14,33 +14,20 @@ * limitations under the License. */ -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.6.6.4 $ - */ package java.beans; import java.util.HashMap; import java.util.Map; -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.6.6.4 $ - */ - public class PropertyEditorManager { - - private static String[] path = {"org.apache.harmony.beans.editors"}; //$NON-NLS-1$ + + private static String[] path = { "org.apache.harmony.beans.editors" }; //$NON-NLS-1$ + private static Map, Class> registeredEditors = new HashMap, Class>(); - - /** - */ + public PropertyEditorManager() { } - /** - * @com.intel.drl.spec_ref - */ public static void registerEditor(Class targetType, Class editorClass) { if (targetType == null) { throw new NullPointerException(); @@ -57,9 +44,6 @@ } } - /** - * @com.intel.drl.spec_ref - */ public static synchronized PropertyEditor findEditor(Class targetType) { if (targetType == null) { throw new NullPointerException(); @@ -90,43 +74,39 @@ + shortEditorClassName.substring(1); } - for (int i = 0; i < path.length; ++i) { - editorClassName = path[i] + "." + shortEditorClassName; //$NON-NLS-1$ + for (String element : path) { + editorClassName = element + "." + shortEditorClassName; //$NON-NLS-1$ try { editorClass = Class.forName(editorClassName, true, loader); break; - } catch (Exception e) {} + } catch (Exception e) { + } } - } catch (Exception e) {} + } catch (Exception e) { + } } if (editorClass != null) { try { editor = (PropertyEditor) editorClass.newInstance(); - } catch (Exception e) {} + } catch (Exception e) { + } } return editor; } - /** - * @com.intel.drl.spec_ref - */ public static synchronized void setEditorSearchPath(String[] apath) { SecurityManager sm = System.getSecurityManager(); - if (sm != null) { sm.checkPropertiesAccess(); } - + path = apath; } - /** - * @com.intel.drl.spec_ref - */ public static synchronized String[] getEditorSearchPath() { return path; } Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyEditorSupport.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyEditorSupport.java?view=diff&rev=450827&r1=450826&r2=450827 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyEditorSupport.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyEditorSupport.java Thu Sep 28 05:13:24 2006 @@ -25,11 +25,13 @@ import org.apache.harmony.beans.internal.nls.Messages; public class PropertyEditorSupport implements PropertyEditor { - + Object source = null; - List listeners = - new ArrayList(); + + List listeners = new ArrayList(); + Object oldValue = null; + Object newValue = null; public PropertyEditorSupport(Object source) { @@ -47,7 +49,7 @@ } public void setAsText(String text) throws IllegalArgumentException { - if (newValue instanceof String){ + if (newValue instanceof String) { setValue(text); } else { throw new IllegalArgumentException(text); @@ -113,14 +115,12 @@ public void firePropertyChange() { if (listeners.size() > 0) { - PropertyChangeEvent event = new PropertyChangeEvent( - source, null, oldValue, newValue); + PropertyChangeEvent event = new PropertyChangeEvent(source, null, + oldValue, newValue); Iterator iterator = listeners.iterator(); while (iterator.hasNext()) { - PropertyChangeListener listener = - (PropertyChangeListener) iterator.next(); - + PropertyChangeListener listener = iterator.next(); listener.propertyChange(event); } } Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyVetoException.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyVetoException.java?view=diff&rev=450827&r1=450826&r2=450827 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyVetoException.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyVetoException.java Thu Sep 28 05:13:24 2006 @@ -14,10 +14,6 @@ * limitations under the License. */ -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.2.6.3 $ - */ package java.beans; /** @@ -30,9 +26,14 @@ private final PropertyChangeEvent evt; /** - *

Constructs an instance with a message and the change event.

- * @param message A description of the veto. - * @param event The event that was vetoed. + *

+ * Constructs an instance with a message and the change event. + *

+ * + * @param message + * A description of the veto. + * @param event + * The event that was vetoed. */ public PropertyVetoException(String message, PropertyChangeEvent event) { super(message); @@ -40,7 +41,10 @@ } /** - *

Gets the property change event.

+ *

+ * Gets the property change event. + *

+ * * @return An instance of {@link PropertyChangeEvent} */ public PropertyChangeEvent getPropertyChangeEvent() { Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SimpleBeanInfo.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SimpleBeanInfo.java?view=diff&rev=450827&r1=450826&r2=450827 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SimpleBeanInfo.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SimpleBeanInfo.java Thu Sep 28 05:13:24 2006 @@ -14,10 +14,6 @@ * limitations under the License. */ -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.4.6.3 $ - */ package java.beans; import java.awt.Image; @@ -28,114 +24,78 @@ import java.util.ArrayList; import java.util.Iterator; -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.4.6.3 $ - */ - public class SimpleBeanInfo implements BeanInfo { - /** - * @com.intel.drl.spec_ref - */ public SimpleBeanInfo() { } - /** - * @com.intel.drl.spec_ref - */ public Image loadImage(String resourceName) { byte[] result = null; - InputStream is = FileInputStream.class.getResourceAsStream( - resourceName); - - if(is != null) { + InputStream is = FileInputStream.class + .getResourceAsStream(resourceName); + + if (is != null) { ArrayList byteArrayList = new ArrayList(); - + byte b; try { - while((b = (byte) is.read()) != -1) { + while ((b = (byte) is.read()) != -1) { byteArrayList.add(new Byte(b)); } - + result = new byte[byteArrayList.size()]; - + Iterator i = byteArrayList.iterator(); int idx = 0; - while(i.hasNext()) { + while (i.hasNext()) { result[idx++] = i.next().byteValue(); } - + } catch (IOException ioe) { byteArrayList.clear(); System.out.println(ioe.getClass() + ": " + ioe.getMessage()); //$NON-NLS-1$ } finally { - try { - is.close(); - } catch (IOException ioe) { - System.out.println(ioe.getClass() + ": " //$NON-NLS-1$ - + ioe.getMessage()); - } + try { + is.close(); + } catch (IOException ioe) { + System.out.println(ioe.getClass() + ": " //$NON-NLS-1$ + + ioe.getMessage()); + } } - + return Toolkit.getDefaultToolkit().createImage(result); - } else { - return null; } + return null; } - /** - * @com.intel.drl.spec_ref - */ public PropertyDescriptor[] getPropertyDescriptors() { return null; } - /** - * @com.intel.drl.spec_ref - */ public MethodDescriptor[] getMethodDescriptors() { return null; } - /** - * @com.intel.drl.spec_ref - */ public EventSetDescriptor[] getEventSetDescriptors() { return null; } - /** - * @com.intel.drl.spec_ref - */ public BeanInfo[] getAdditionalBeanInfo() { return null; } - /** - * @com.intel.drl.spec_ref - */ public BeanDescriptor getBeanDescriptor() { return null; } - /** - * @com.intel.drl.spec_ref - */ public Image getIcon(int iconKind) { return null; } - /** - * @com.intel.drl.spec_ref - */ public int getDefaultPropertyIndex() { return -1; } - /** - * @com.intel.drl.spec_ref - */ public int getDefaultEventIndex() { return -1; } Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Statement.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Statement.java?view=diff&rev=450827&r1=450826&r2=450827 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Statement.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Statement.java Thu Sep 28 05:13:24 2006 @@ -14,10 +14,6 @@ * limitations under the License. */ -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.18.6.3 $ - */ package java.beans; import java.lang.reflect.Array; @@ -32,11 +28,6 @@ import org.apache.harmony.beans.internal.nls.Messages; -/** - * @author Maxim V. Berkultsev - * @version $Revision: 1.18.6.3 $ - */ - public class Statement { private Object target; @@ -45,9 +36,6 @@ private Object[] arguments; - /** - * @com.intel.drl.spec_ref - */ public Statement(Object target, String methodName, Object[] arguments) { this.target = target; this.methodName = methodName; @@ -58,9 +46,6 @@ } } - /** - * @com.intel.drl.spec_ref - */ public String toString() { StringBuffer sb = new StringBuffer(); String targetVar = target != null ? convertClassName(target.getClass()) @@ -93,37 +78,24 @@ return sb.toString(); } - /** - * @com.intel.drl.spec_ref - */ public String getMethodName() { return methodName; } - /** - * @com.intel.drl.spec_ref - */ public Object[] getArguments() { return arguments; } - /** - * @com.intel.drl.spec_ref - */ public Object getTarget() { return target; } - /** - * @com.intel.drl.spec_ref - */ public void execute() throws Exception { invokeMethod(); } Object invokeMethod() throws Exception { Object result = null; - try { if (target.getClass().isArray()) { Method method = findArrayMethod(); @@ -163,7 +135,8 @@ result = method.invoke(null, arguments); found = true; } - } catch (NoSuchMethodException e) {} + } catch (NoSuchMethodException e) { + } if (!found) { // static method was not found @@ -229,10 +202,9 @@ if (methodName.equals("get")) { //$NON-NLS-1$ return Array.class.getMethod("get", new Class[] { Object.class, //$NON-NLS-1$ int.class }); - } else { - return Array.class.getMethod("set", new Class[] { Object.class, //$NON-NLS-1$ - int.class, Object.class }); } + return Array.class.getMethod("set", new Class[] { Object.class, //$NON-NLS-1$ + int.class, Object.class }); } private Object[] getArrayMethodArguments() { @@ -367,7 +339,7 @@ } } - /** + /* * The list of "method signatures" used by persistence delegates to create * objects. Not necessary reflects to real methods. */ @@ -499,14 +471,12 @@ if (!argsEqual) { return false; - } else { - return (s.getTarget() == this.getTarget() && s.getMethodName() - .equals(this.getMethodName())); } + return (s.getTarget() == this.getTarget() && s.getMethodName() + .equals(this.getMethodName())); - } else { - return false; } + return false; } /** @@ -548,7 +518,8 @@ * Returns the norm for given method. The norm is the "distance" from * the reference method to the given method. * - * @param m the method to calculate the norm for + * @param m + * the method to calculate the norm for * @return norm of given method */ private int getNorm(Method m) { @@ -566,10 +537,9 @@ if (referenceMethodArgumentTypes[i] == null) { if (argumentTypes[i].isPrimitive()) { return INFINITY; - } else { - // doesn't affect the norm calculation if null - continue; } + // doesn't affect the norm calculation if null + continue; } if (referenceMethodArgumentTypes[i].isPrimitive()) { @@ -591,7 +561,8 @@ * Returns a "hierarchy distance" between two classes. * * @param clz1 - * @param clz2 should be superclass or superinterface of clz1 + * @param clz2 + * should be superclass or superinterface of clz1 * @return hierarchy distance from clz1 to clz2, Integer.MAX_VALUE if * clz2 is not assignable from clz1. */ @@ -626,9 +597,8 @@ bestDist = superDist; } return (bestDist != INFINITY ? bestDist + 1 : INFINITY); - } else { - return (superDist != INFINITY ? superDist + 1 : INFINITY); } + return (superDist != INFINITY ? superDist + 1 : INFINITY); } }