You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2006/09/28 14:13:26 UTC
svn commit: r450827 [1/3] - in
/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans:
./ beancontext/
Author: tellison
Date: Thu Sep 28 05:13:24 2006
New Revision: 450827
URL: http://svn.apache.org/viewvc?view=rev&rev=450827
Log:
Code tidy-up in java.beans, including fixing compiler warnings,
adding override markers, code formatting, 5.0 syntax uplifts,
comment fixes, etc. No change in functionality.
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/AppletInitializer.java
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/BeanInfo.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoData.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoImpl.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoWrapper.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Beans.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Customizer.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/DesignMode.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Encoder.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventHandler.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventSetDescriptor.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/ExceptionListener.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Expression.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/IndexedPropertyChangeEvent.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/IndexedPropertyDescriptor.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/IntrospectionException.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Introspector.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/MethodDescriptor.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/ParameterDescriptor.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PersistenceDelegate.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeEvent.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeListener.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeListenerProxy.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyChangeSupport.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyDescriptor.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyEditor.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyEditorManager.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyEditorSupport.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyVetoException.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/SimpleBeanInfo.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Statement.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/VetoableChangeListener.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/VetoableChangeListenerProxy.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/VetoableChangeSupport.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Visibility.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/XMLDecoder.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/XMLEncoder.java
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/beancontext/BeanContext.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/AppletInitializer.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/AppletInitializer.java?view=diff&rev=450827&r1=450826&r2=450827
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/AppletInitializer.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/AppletInitializer.java Thu Sep 28 05:13:24 2006
@@ -14,29 +14,14 @@
* limitations under the License.
*/
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.3.6.3 $
- */
package java.beans;
import java.applet.Applet;
import java.beans.beancontext.BeanContext;
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.3.6.3 $
- */
-
public interface AppletInitializer {
- /**
- * @com.intel.drl.spec_ref
- */
public void initialize(Applet newAppletBean, BeanContext bCtxt);
- /**
- * @com.intel.drl.spec_ref
- */
public void activate(Applet newApplet);
}
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?view=diff&rev=450827&r1=450826&r2=450827
==============================================================================
--- 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 Thu Sep 28 05:13:24 2006
@@ -19,8 +19,6 @@
/**
* Describes a bean's global information.
- *
- * @author Maxim V. Berkultsev
*/
public class BeanDescriptor extends FeatureDescriptor {
@@ -35,8 +33,10 @@
* unqualified name of the <code>beanClass</code>.
* </p>
*
- * @param beanClass The bean's Class.
- * @param customizerClass The bean's customizer Class.
+ * @param beanClass
+ * The bean's Class.
+ * @param customizerClass
+ * The bean's customizer Class.
*/
public BeanDescriptor(Class<?> beanClass, Class<?> customizerClass) {
super();
@@ -55,7 +55,8 @@
* <code>beanClass</code>.
* </p>
*
- * @param beanClass The bean's Class.
+ * @param beanClass
+ * The bean's Class.
*/
public BeanDescriptor(Class<?> beanClass) {
super();
@@ -94,7 +95,8 @@
* Utility method for getting the unqualified name of a {@link Class}.
* </p>
*
- * @param beanClass The Class to get the name from.
+ * @param beanClass
+ * The Class to get the name from.
* @return A String instance or <code>null</code>.
*/
private String getShortClassName(Class<?> beanClass) {
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfo.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfo.java?view=diff&rev=450827&r1=450826&r2=450827
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfo.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfo.java Thu Sep 28 05:13:24 2006
@@ -14,19 +14,10 @@
* limitations under the License.
*/
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.2.6.3 $
- */
package java.beans;
import java.awt.Image;
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.2.6.3 $
- */
-
public interface BeanInfo {
public static final int ICON_COLOR_16x16 = 1;
@@ -37,43 +28,19 @@
public static final int ICON_MONO_32x32 = 4;
- /**
- * @com.intel.drl.spec_ref
- */
public PropertyDescriptor[] getPropertyDescriptors();
- /**
- * @com.intel.drl.spec_ref
- */
public MethodDescriptor[] getMethodDescriptors();
- /**
- * @com.intel.drl.spec_ref
- */
public EventSetDescriptor[] getEventSetDescriptors();
- /**
- * @com.intel.drl.spec_ref
- */
public BeanInfo[] getAdditionalBeanInfo();
- /**
- * @com.intel.drl.spec_ref
- */
public BeanDescriptor getBeanDescriptor();
- /**
- * @com.intel.drl.spec_ref
- */
public Image getIcon(int iconKind);
- /**
- * @com.intel.drl.spec_ref
- */
public int getDefaultPropertyIndex();
- /**
- * @com.intel.drl.spec_ref
- */
public int getDefaultEventIndex();
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoData.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoData.java?view=diff&rev=450827&r1=450826&r2=450827
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoData.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoData.java Thu Sep 28 05:13:24 2006
@@ -19,8 +19,11 @@
class BeanInfoData {
private Class<?> stopClass;
+
private boolean ignoreBeanClassBeanInfo;
+
private boolean ignoreSuperClassBeanInfo;
+
private BeanInfoWrapper beanInfoWrapper;
public BeanInfoData(BeanInfoWrapper beanInfo) {
@@ -31,8 +34,7 @@
}
public BeanInfoData(Class<?> stopClass, boolean ignoreBeanClassBeanInfo,
- boolean ignoreSuperClassBeanInfo, BeanInfoWrapper beanInfoWrapper)
- {
+ boolean ignoreSuperClassBeanInfo, BeanInfoWrapper beanInfoWrapper) {
this.stopClass = stopClass;
this.ignoreBeanClassBeanInfo = ignoreBeanClassBeanInfo;
this.ignoreSuperClassBeanInfo = ignoreSuperClassBeanInfo;
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoImpl.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoImpl.java?view=diff&rev=450827&r1=450826&r2=450827
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoImpl.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoImpl.java Thu Sep 28 05:13:24 2006
@@ -65,7 +65,7 @@
Object[] values;
while (iterator.hasNext()) {
- Method method = (Method) iterator.next();
+ Method method = iterator.next();
int methodType = getMethodType(method);
@@ -90,7 +90,8 @@
booleanGetters, false);
addPropertyDescriptorsFromMethodList(result, setters, true);
addPropertyDescriptorsFromMethodList(result, getters, true);
- } catch (Exception e) {}
+ } catch (Exception e) {
+ }
values = result.values().toArray();
propertyDescriptors = new PropertyDescriptor[values.length];
@@ -111,13 +112,13 @@
Iterator<Method> iterator = beanClassMethodsArrayList.iterator();
while (iterator.hasNext()) {
- Method method = (Method) iterator.next();
+ Method method = iterator.next();
result.add(new MethodDescriptor(method));
}
methodDescriptors = new MethodDescriptor[result.size()];
for (int i = 0; i < methodDescriptors.length; ++i) {
- methodDescriptors[i] = (MethodDescriptor) result.get(i);
+ methodDescriptors[i] = result.get(i);
}
}
@@ -133,7 +134,7 @@
Iterator<Method> iterator = beanClassMethodsArrayList.iterator();
while (iterator.hasNext()) {
- Method method = (Method) iterator.next();
+ Method method = iterator.next();
String methodName = method.getName();
String listenerName = null;
@@ -159,8 +160,10 @@
// full and short names of classes
String listenerTypeName = listenerType.getName();
- // check if the listener name extracted from param name and
- // listener name extracted from registration method are the same
+ // check if the listener name extracted from param
+ // name and
+ // listener name extracted from registration method
+ // are the same
String listenerNameFromParam = listenerTypeName
.substring(listenerTypeName
.lastIndexOf(".") + 1); //$NON-NLS-1$
@@ -184,7 +187,8 @@
eventType = Class.forName(eventTypeName, true,
beanClass.getClassLoader());
} catch (ClassNotFoundException cnfe) {
- System.out.println(Messages.getString("beans.3A", eventTypeName)); //$NON-NLS-1$
+ System.out.println(Messages.getString(
+ "beans.3A", eventTypeName)); //$NON-NLS-1$
} finally {
if (eventType == null) {
continue;
@@ -193,13 +197,13 @@
Method[] methods = listenerType.getMethods();
Vector<Method> listenerMethodsVec = new Vector<Method>();
- for (int i = 0; i < methods.length; ++i) {
- Class[] listenerMethodParams = methods[i]
+ for (Method element : methods) {
+ Class[] listenerMethodParams = element
.getParameterTypes();
if (listenerMethodParams.length == 1
&& listenerMethodParams[0] == eventType) {
- listenerMethodsVec.add(methods[i]);
+ listenerMethodsVec.add(element);
}
}
@@ -209,7 +213,7 @@
.iterator();
int idx2 = 0;
while (iter.hasNext()) {
- listenerMethods[idx2] = (Method) iter.next();
+ listenerMethods[idx2] = iter.next();
idx2++;
}
@@ -244,7 +248,8 @@
getListenerMethod = beanClass.getMethod(
getListenerMethodName, new Class[] {});
} catch (NoSuchMethodException nsme) {
- // no action - getter is not a mandatory method in event set descriptor pattern
+ // no action - getter is not a mandatory method
+ // in event set descriptor pattern
}
try {
@@ -256,8 +261,8 @@
removeListenerMethod, getListenerMethod);
result.put(listenerName, esd);
} catch (IntrospectionException ie) {
- System.out
- .println(Messages.getString("beans.39", listenerName)); //$NON-NLS-1$
+ System.out.println(Messages.getString(
+ "beans.39", listenerName)); //$NON-NLS-1$
}
}
@@ -271,16 +276,14 @@
int idx = 0;
while (i.hasNext()) {
- eventSetDescriptorNames[idx++] = ((EventSetDescriptor) result
- .get((String) i.next())).getName();
+ eventSetDescriptorNames[idx++] = result.get(i.next()).getName();
}
Arrays.sort(eventSetDescriptorNames);
eventSetDescriptors = new EventSetDescriptor[eventSetDescriptorNames.length];
for (int j = 0; j < eventSetDescriptors.length; ++j) {
- eventSetDescriptors[j] = (EventSetDescriptor) result
- .get(eventSetDescriptorNames[j]);
+ eventSetDescriptors[j] = result.get(eventSetDescriptorNames[j]);
}
}
@@ -370,9 +373,9 @@
List<Method> result = new ArrayList<Method>();
Method[] beanClassMethods = theClass.getDeclaredMethods();
- for (int i = 0; i < beanClassMethods.length; ++i) {
- if (Modifier.isPublic(beanClassMethods[i].getModifiers())) {
- result.add(beanClassMethods[i]);
+ for (Method element : beanClassMethods) {
+ if (Modifier.isPublic(element.getModifiers())) {
+ result.add(element);
}
}
@@ -394,13 +397,13 @@
propertyDescriptor = new PropertyDescriptor(propertyName,
beanClass);
} catch (IntrospectionException ie) {
- //no setter or getter
+ // no setter or getter
if (methodName.startsWith("set")) { //$NON-NLS-1$
try {
propertyDescriptor = new PropertyDescriptor(
propertyName, beanClass, null, methodName);
} catch (IntrospectionException e) {
- //no getter
+ // no getter
}
} else if (methodName.startsWith("get") //$NON-NLS-1$
|| methodName.startsWith("is")) { //$NON-NLS-1$
@@ -408,7 +411,7 @@
propertyDescriptor = new PropertyDescriptor(
propertyName, beanClass, methodName, null);
} catch (IntrospectionException e) {
- //no setter
+ // no setter
}
} else {
try {
@@ -442,7 +445,8 @@
hmPropertyDescriptors.put(propertyName,
indexedPropertyDescriptor);
} catch (IntrospectionException ie) {
- //System.out.println(ie.getClass() + ": " + ie.getMessage()); //$NON-NLS-1$
+ // System.out.println(ie.getClass() + ": " +
+ // ie.getMessage()); //$NON-NLS-1$
}
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoWrapper.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoWrapper.java?view=diff&rev=450827&r1=450826&r2=450827
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoWrapper.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/BeanInfoWrapper.java Thu Sep 28 05:13:24 2006
@@ -25,29 +25,29 @@
import java.util.Map;
class BeanInfoWrapper implements BeanInfo {
-
+
private BeanInfo info;
+
private BeanInfoImpl impl;
+
private BeanInfoWrapper parentBeanInfoWrapper;
-
+
public BeanInfoWrapper(BeanInfo info, BeanInfoImpl impl) {
this.info = info;
this.impl = impl;
}
-
+
public PropertyDescriptor[] getPropertyDescriptors() {
PropertyDescriptor[] result = null;
PropertyDescriptor[] infoResult = null;
-
+
if (info != null) {
BeanInfo[] infos = info.getAdditionalBeanInfo();
infoResult = info.getPropertyDescriptors();
if (infos != null) {
- for (int i = 0; i < infos.length; ++i) {
- BeanInfo additionalInfo = infos[i];
-
+ for (BeanInfo additionalInfo : infos) {
if (infoResult == null) {
infoResult = additionalInfo.getPropertyDescriptors();
} else {
@@ -63,10 +63,10 @@
// merge with parent info
if (parentBeanInfoWrapper != null) {
- PropertyDescriptor[] parentResult =
- parentBeanInfoWrapper.getPropertyDescriptors();
- Map<String, FeatureDescriptor> hm =
- concatArraysUniqueByName(implResult, parentResult);
+ PropertyDescriptor[] parentResult = parentBeanInfoWrapper
+ .getPropertyDescriptors();
+ Map<String, FeatureDescriptor> hm = concatArraysUniqueByName(
+ implResult, parentResult);
Collection<FeatureDescriptor> values = hm.values();
Iterator<FeatureDescriptor> iterator;
@@ -83,6 +83,8 @@
PropertyDescriptor pd2) {
return pd1.getName().compareTo(pd2.getName());
}
+
+ @Override
public boolean equals(Object o) {
return false;
}
@@ -93,23 +95,21 @@
} else {
result = infoResult;
}
-
+
return result;
}
public MethodDescriptor[] getMethodDescriptors() {
MethodDescriptor[] result = null;
MethodDescriptor[] infoResult = null;
-
+
if (info != null) {
BeanInfo[] infos = info.getAdditionalBeanInfo();
infoResult = info.getMethodDescriptors();
if (infos != null) {
- for (int i = 0; i < infos.length; ++i) {
- BeanInfo additionalInfo = infos[i];
-
+ for (BeanInfo additionalInfo : infos) {
if (infoResult == null) {
infoResult = additionalInfo.getMethodDescriptors();
} else {
@@ -125,8 +125,8 @@
// merge with parent info
if (parentBeanInfoWrapper != null) {
- MethodDescriptor[] parentResult =
- parentBeanInfoWrapper.getMethodDescriptors();
+ MethodDescriptor[] parentResult = parentBeanInfoWrapper
+ .getMethodDescriptors();
result = concatArraysToOneArray(implResult, parentResult);
} else {
@@ -141,12 +141,14 @@
public int compare(MethodDescriptor md1, MethodDescriptor md2) {
return md1.getName().compareTo(md2.getName());
}
+
+ @Override
public boolean equals(Object o) {
return false;
}
});
}
-
+
return result;
}
@@ -160,9 +162,7 @@
infoResult = info.getEventSetDescriptors();
if (infos != null) {
- for (int i = 0; i < infos.length; ++i) {
- BeanInfo additionalInfo = infos[i];
-
+ for (BeanInfo additionalInfo : infos) {
if (infoResult == null) {
infoResult = additionalInfo.getEventSetDescriptors();
} else {
@@ -178,26 +178,28 @@
// merge with parent info
if (parentBeanInfoWrapper != null) {
- EventSetDescriptor[] parentResult =
- parentBeanInfoWrapper.getEventSetDescriptors();
+ EventSetDescriptor[] parentResult = parentBeanInfoWrapper
+ .getEventSetDescriptors();
Map<String, FeatureDescriptor> hm = concatArraysUniqueByName(
implResult, parentResult);
-
+
Collection<FeatureDescriptor> values = hm.values();
Iterator<FeatureDescriptor> iterator;
int idx = 0;
-
+
result = new EventSetDescriptor[values.size()];
iterator = values.iterator();
while (iterator.hasNext()) {
result[idx++] = (EventSetDescriptor) iterator.next();
}
-
+
Arrays.sort(result, new Comparator<EventSetDescriptor>() {
public int compare(EventSetDescriptor esd1,
- EventSetDescriptor esd2) {
+ EventSetDescriptor esd2) {
return esd1.getName().compareTo(esd2.getName());
}
+
+ @Override
public boolean equals(Object o) {
return false;
}
@@ -266,42 +268,39 @@
if (info != null) {
result = info.getDefaultEventIndex();
}
-
+
if (info == null || result == -1) {
result = impl.getDefaultEventIndex();
}
return result;
}
-
+
void merge(BeanInfoWrapper parentBeanInfoWrapper) {
this.parentBeanInfoWrapper = parentBeanInfoWrapper;
}
-
- private static Map<String, FeatureDescriptor>
- concatArraysUniqueByName(FeatureDescriptor[] childs,
- FeatureDescriptor[] parents)
- {
- Map<String, FeatureDescriptor> result =
- new HashMap<String, FeatureDescriptor>();
+
+ private static Map<String, FeatureDescriptor> concatArraysUniqueByName(
+ FeatureDescriptor[] childs, FeatureDescriptor[] parents) {
+ Map<String, FeatureDescriptor> result = new HashMap<String, FeatureDescriptor>();
if (childs != null) {
- for (int i = 0; i < childs.length; ++i) {
- result.put(childs[i].getName(), childs[i]);
+ for (FeatureDescriptor element : childs) {
+ result.put(element.getName(), element);
}
}
if (parents != null) {
- for (int j = 0; j < parents.length; ++j) {
- if (result.get(parents[j].getName()) == null) {
- result.put(parents[j].getName(), parents[j]);
+ for (FeatureDescriptor element : parents) {
+ if (result.get(element.getName()) == null) {
+ result.put(element.getName(), element);
}
}
}
return result;
}
-
+
private static PropertyDescriptor[] concatArraysToOneArray(
PropertyDescriptor[] childs, PropertyDescriptor[] parents) {
if (childs != null || parents != null) {
@@ -313,26 +312,26 @@
int idx = 0;
while (iterator.hasNext()) {
- String name = (String) iterator.next();
+ String name = iterator.next();
result[idx++] = (PropertyDescriptor) hm.get(name);
}
return result;
- } else {
- return null;
}
+
+ return null;
}
-
+
private static MethodDescriptor[] concatArraysToOneArray(
MethodDescriptor[] childs, MethodDescriptor[] parents) {
MethodDescriptor[] result = null;
-
+
if (childs != null || parents != null) {
int resultLength = 0;
if (childs != null) {
- resultLength = childs.length;
+ resultLength = childs.length;
}
if (parents != null) {
@@ -346,7 +345,7 @@
result[i] = childs[i];
}
}
-
+
if (parents != null) {
int shift = (childs == null) ? 0 : childs.length;
@@ -354,31 +353,31 @@
result[shift + i] = parents[i];
}
}
-
+
}
return result;
}
-
+
private static EventSetDescriptor[] concatArraysToOneArray(
EventSetDescriptor[] childs, EventSetDescriptor[] parents) {
if (childs != null || parents != null) {
- Map<String, FeatureDescriptor> hm =
- concatArraysUniqueByName(childs, parents);
+ Map<String, FeatureDescriptor> hm = concatArraysUniqueByName(
+ childs, parents);
EventSetDescriptor[] result = new EventSetDescriptor[hm.size()];
Iterator<String> iterator = hm.keySet().iterator();
int idx = 0;
while (iterator.hasNext()) {
- String name = (String) iterator.next();
+ String name = iterator.next();
result[idx++] = (EventSetDescriptor) hm.get(name);
}
return result;
- } else {
- return null;
}
+
+ return null;
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Beans.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Beans.java?view=diff&rev=450827&r1=450826&r2=450827
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Beans.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Beans.java Thu Sep 28 05:13:24 2006
@@ -14,10 +14,6 @@
* limitations under the License.
*/
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.6.6.3 $
- */
package java.beans;
import java.applet.Applet;
@@ -30,24 +26,15 @@
import org.apache.harmony.beans.internal.nls.Messages;
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.6.6.3 $
- */
-
public class Beans {
private static boolean designTime = false;
private static boolean guiAvailable = false;
- /**
- */
- public Beans() {}
-
- /**
- * @com.intel.drl.spec_ref
- */
+ public Beans() {
+ }
+
public static Object instantiate(ClassLoader cls, String beanName,
BeanContext beanContext, AppletInitializer initializer)
throws IOException, ClassNotFoundException {
@@ -60,9 +47,6 @@
return result;
}
- /**
- * @com.intel.drl.spec_ref
- */
public static Object instantiate(ClassLoader cls, String beanName,
BeanContext beanContext) throws IOException, ClassNotFoundException {
Object result = instantiate(cls, beanName);
@@ -74,9 +58,6 @@
return result;
}
- /**
- * @com.intel.drl.spec_ref
- */
public static Object instantiate(ClassLoader cls, String beanName)
throws IOException, ClassNotFoundException {
Object result = null;
@@ -128,16 +109,10 @@
return result;
}
- /**
- * @com.intel.drl.spec_ref
- */
public static Object getInstanceOf(Object bean, Class<?> targetType) {
return bean;
}
- /**
- * @com.intel.drl.spec_ref
- */
public static boolean isInstanceOf(Object bean, Class<?> targetType) {
if (bean == null) {
throw new NullPointerException(Messages.getString("beans.1D")); //$NON-NLS-1$
@@ -146,34 +121,22 @@
return targetType == null ? false : targetType.isInstance(bean);
}
- /**
- * @com.intel.drl.spec_ref
- */
public static void setGuiAvailable(boolean isGuiAvailable)
throws SecurityException {
checkPropertiesAccess();
guiAvailable = isGuiAvailable;
}
- /**
- * @com.intel.drl.spec_ref
- */
public static void setDesignTime(boolean isDesignTime)
throws SecurityException {
checkPropertiesAccess();
designTime = isDesignTime;
}
- /**
- * @com.intel.drl.spec_ref
- */
public static boolean isGuiAvailable() {
return guiAvailable;
}
- /**
- * @com.intel.drl.spec_ref
- */
public static boolean isDesignTime() {
return designTime;
}
@@ -193,8 +156,8 @@
}
/**
- * Customized object input stream that allows
- * to read objects by specified class loader
+ * Customized object input stream that allows to read objects by specified class
+ * loader
*/
class CustomizedObjectInputStream extends ObjectInputStream {
@@ -244,12 +207,13 @@
componentType = cls.loadClass(postfix.substring(1, postfix
.length() - 1));
} else {
- throw new IllegalArgumentException(Messages.getString("beans.1E", className)); //$NON-NLS-1$
+ throw new IllegalArgumentException(Messages.getString(
+ "beans.1E", className)); //$NON-NLS-1$
}
return Array.newInstance(componentType, dimensions).getClass();
- } else {
- return Class.forName(className, true, cls);
}
+
+ return Class.forName(className, true, cls);
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Customizer.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Customizer.java?view=diff&rev=450827&r1=450826&r2=450827
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Customizer.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Customizer.java Thu Sep 28 05:13:24 2006
@@ -14,31 +14,13 @@
* limitations under the License.
*/
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.4.6.3 $
- */
package java.beans;
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.4.6.3 $
- */
-
public interface Customizer {
- /**
- * @com.intel.drl.spec_ref
- */
public void setObject(Object bean);
- /**
- * @com.intel.drl.spec_ref
- */
public void removePropertyChangeListener(PropertyChangeListener listener);
- /**
- * @com.intel.drl.spec_ref
- */
public void addPropertyChangeListener(PropertyChangeListener listener);
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java?view=diff&rev=450827&r1=450826&r2=450827
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java Thu Sep 28 05:13:24 2006
@@ -31,11 +31,11 @@
if (constructorPropertyNames != null) {
arr = new String[constructorPropertyNames.length];
for (int i = 0; i < constructorPropertyNames.length; i++) {
- if (constructorPropertyNames[i] != null &&
- constructorPropertyNames[i].length() > 0) {
- arr[i] = constructorPropertyNames[i].substring(0,1)
- .toLowerCase() +
- constructorPropertyNames[i].substring(1);
+ if (constructorPropertyNames[i] != null
+ && constructorPropertyNames[i].length() > 0) {
+ arr[i] = constructorPropertyNames[i].substring(0, 1)
+ .toLowerCase()
+ + constructorPropertyNames[i].substring(1);
} else {
arr[i] = constructorPropertyNames[i];
}
@@ -49,15 +49,14 @@
this.constructorPropertyNames = null;
}
+ @Override
protected void initialize(Class<?> type, Object oldInstance,
Object newInstance, Encoder out) {
try {
PropertyDescriptor[] pds = Introspector.getBeanInfo(type)
.getPropertyDescriptors();
- for (int i = 0; i < pds.length; ++i) {
- PropertyDescriptor pd = pds[i];
-
+ for (PropertyDescriptor pd : pds) {
if (!isTransient(pd)) {
Method getter = pd.getReadMethod();
@@ -95,6 +94,7 @@
}
}
+ @Override
protected Expression instantiate(Object oldInstance, Encoder out) {
Object[] args = null;
@@ -112,29 +112,31 @@
boolean found = false;
- for (int j = 0; j < pds.length; ++j) {
+ for (PropertyDescriptor element : pds) {
- if (constructorPropertyNames[i]
- .equals(pds[j].getName())) {
- Method getter = pds[j].getReadMethod();
+ if (constructorPropertyNames[i].equals(element
+ .getName())) {
+ Method getter = element.getReadMethod();
if (getter != null) {
args[i] = getter.invoke(oldInstance,
(Object[]) null);
found = true;
break;
- } else {
- throw new NoSuchMethodException(Messages.getString("beans.00", pds[j].getName())); //$NON-NLS-1$
}
+ throw new NoSuchMethodException(Messages.getString(
+ "beans.00", element.getName())); //$NON-NLS-1$
+
}
- } // for j
+ }
if (found == false) {
- throw new NoSuchMethodException(Messages.getString("beans.01", constructorPropertyNames[i])); //$NON-NLS-1$
+ throw new NoSuchMethodException(Messages.getString(
+ "beans.01", constructorPropertyNames[i])); //$NON-NLS-1$
}
- } // for i
+ }
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
@@ -146,6 +148,7 @@
return new Expression(oldInstance, oldInstance.getClass(), "new", args); //$NON-NLS-1$
}
+ @Override
protected boolean mutatesTo(Object oldInstance, Object newInstance) {
if (oldInstance != null) {
try {
@@ -160,7 +163,8 @@
}
} catch (Exception e) {
// XXX bad style of logging
- System.out.println(Messages.getString("beans.02", e.getClass(), e.getMessage())); //$NON-NLS-1$
+ System.out.println(Messages.getString(
+ "beans.02", e.getClass(), e.getMessage())); //$NON-NLS-1$
return false;
}
@@ -170,7 +174,6 @@
private static boolean isTransient(PropertyDescriptor pd) {
Boolean isTransient = (Boolean) pd.getValue("transient"); //$NON-NLS-1$
-
return (isTransient != null) && isTransient.equals(Boolean.TRUE);
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/DesignMode.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/DesignMode.java?view=diff&rev=450827&r1=450826&r2=450827
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/DesignMode.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/DesignMode.java Thu Sep 28 05:13:24 2006
@@ -14,28 +14,13 @@
* limitations under the License.
*/
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.3.6.3 $
- */
package java.beans;
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.3.6.3 $
- */
-
public interface DesignMode {
public static final String PROPERTYNAME = "designTime"; //$NON-NLS-1$
- /**
- * @com.intel.drl.spec_ref
- */
public void setDesignTime(boolean designTime);
- /**
- * @com.intel.drl.spec_ref
- */
public boolean isDesignTime();
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Encoder.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Encoder.java?view=diff&rev=450827&r1=450826&r2=450827
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Encoder.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Encoder.java Thu Sep 28 05:13:24 2006
@@ -14,20 +14,14 @@
* limitations under the License.
*/
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.14.6.4 $
- */
package java.beans;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Vector;
+import org.apache.harmony.beans.DefaultPersistenceDelegatesFactory;
import org.apache.harmony.beans.NullPersistenceDelegate;
import org.apache.harmony.beans.ObjectNode;
-import org.apache.harmony.beans.DefaultPersistenceDelegatesFactory;
import org.apache.harmony.beans.internal.nls.Messages;
public class Encoder {
@@ -40,14 +34,10 @@
HashMap<Object, ObjectNode> nodes = new HashMap<Object, ObjectNode>();
- /**
- * @com.intel.drl.spec_ref
- */
- public Encoder() {}
+ public Encoder() {
+ super();
+ }
- /**
- * @com.intel.drl.spec_ref
- */
public Object get(Object oldInstance) {
if (oldInstance == null) {
return null;
@@ -56,11 +46,8 @@
return getValue(nodes.get(oldInstance));
}
- /**
- * @com.intel.drl.spec_ref
- */
public Object remove(Object oldInstance) {
- //TODO - notify references on node deletion
+ // TODO - notify references on node deletion
if (oldInstance == null) {
return null;
}
@@ -68,9 +55,6 @@
return getValue(nodes.remove(oldInstance));
}
- /**
- * @com.intel.drl.spec_ref
- */
public PersistenceDelegate getPersistenceDelegate(Class<?> type) {
PersistenceDelegate result = persistenceDelegates.get(type);
@@ -82,17 +66,11 @@
return result;
}
- /**
- * @com.intel.drl.spec_ref
- */
public void setPersistenceDelegate(Class<?> type,
PersistenceDelegate persistenceDelegate) {
persistenceDelegates.put(type, persistenceDelegate);
}
- /**
- * @com.intel.drl.spec_ref
- */
protected void writeObject(Object object) {
roots.add(object);
doWriteObject(object);
@@ -110,9 +88,6 @@
pd.writeObject(object, this);
}
- /**
- * @com.intel.drl.spec_ref
- */
public void writeStatement(Statement oldStm) {
ObjectNode node = nodes.get(oldStm.getTarget());
@@ -123,8 +98,8 @@
// FIXME add target processing here
write(oldArgs);
- statement = new Statement(node.getObjectValue(),
- oldStm.getMethodName(), oldArgs);
+ statement = new Statement(node.getObjectValue(), oldStm
+ .getMethodName(), oldArgs);
statement.execute();
node.addStatement(statement);
} catch (Exception e) {
@@ -133,13 +108,11 @@
} else {
// FIXME incompatible with RI, default constructor should be
// called instead
- System.out.println(Messages.getString("beans.10", oldStm.getTarget())); //$NON-NLS-1$
+ System.out.println(Messages.getString(
+ "beans.10", oldStm.getTarget())); //$NON-NLS-1$
}
}
- /**
- * @com.intel.drl.spec_ref
- */
public void writeExpression(Expression oldExp) {
try {
Object oldValue = oldExp.getValue();
@@ -148,14 +121,13 @@
ObjectNode valueNode = null;
Class<?> valueType = null;
- // write target
- if (!Statement.isPDConstructor(oldExp) &&
- !Statement.isStaticMethodCall(oldExp))
- {
+ // write target
+ if (!Statement.isPDConstructor(oldExp)
+ && !Statement.isStaticMethodCall(oldExp)) {
ObjectNode parent;
- //XXX investigate
- //write(oldTarget);
+ // XXX investigate
+ // write(oldTarget);
parent = nodes.get(oldTarget);
if (parent != null) {
parent.addExpression(oldExp);
@@ -163,7 +135,7 @@
}
// write value
-
+
if (oldValue != null) {
valueType = oldValue.getClass();
valueNode = nodes.get(oldValue);
@@ -172,8 +144,7 @@
if (valueNode == null) {
if (isNull(valueType) || isPrimitive(valueType)
- || isString(valueType))
- {
+ || isString(valueType)) {
valueNode = new ObjectNode(oldExp);
} else {
write(oldExp.getArguments());
@@ -195,16 +166,10 @@
}
}
- /**
- * @com.intel.drl.spec_ref
- */
public void setExceptionListener(ExceptionListener exceptionListener) {
this.exceptionListener = exceptionListener;
}
- /**
- * @com.intel.drl.spec_ref
- */
public ExceptionListener getExceptionListener() {
if (exceptionListener == null) {
exceptionListener = new ExceptionListener() {
@@ -247,9 +212,9 @@
return null;
}
- /**
- * @param node node to return the value for
- * @return tentative object value for given node
+ /*
+ * @param node node to return the value for @return tentative object value
+ * for given node
*/
private Object getValue(ObjectNode node) {
if (node != null) {
@@ -287,7 +252,7 @@
static boolean isArray(Class<?> type) {
return type.isArray();
}
-
+
static String getPrimitiveName(Class<?> type) {
String result = null;
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventHandler.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventHandler.java?view=diff&rev=450827&r1=450826&r2=450827
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventHandler.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventHandler.java Thu Sep 28 05:13:24 2006
@@ -14,10 +14,6 @@
* limitations under the License.
*/
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.7.6.3 $
- */
package java.beans;
import java.lang.reflect.InvocationHandler;
@@ -38,9 +34,6 @@
private String listenerMethodName;
- /**
- * @com.intel.drl.spec_ref
- */
public EventHandler(Object target, String action, String eventPropertyName,
String listenerMethodName) {
this.target = target;
@@ -49,13 +42,10 @@
this.listenerMethodName = listenerMethodName;
}
- /**
- * @com.intel.drl.spec_ref
- */
public Object invoke(Object proxy, Method method, Object[] arguments) {
Class<?> proxyClass;
Object result = null;
-
+
// XXX
if (arguments == null) {
arguments = new Object[0];
@@ -72,22 +62,20 @@
// if the method from the Object class is called
if (method.getDeclaringClass().equals(Object.class)) {
- if (method.getName().equals("hashCode") && //$NON-NLS-1$
+ if (method.getName().equals("hashCode") && //$NON-NLS-1$
arguments.length == 0) {
result = hashCode();
} else if (method.getName().equals("equals") && //$NON-NLS-1$
- arguments.length == 1 &&
- arguments[0] != null) {
+ arguments.length == 1 && arguments[0] != null) {
result = (proxy == arguments[0]);
} else if (method.getName().equals("toString") && //$NON-NLS-1$
arguments.length == 0) {
- result = proxy.getClass().getSimpleName() +
- toString().substring(
+ result = proxy.getClass().getSimpleName()
+ + toString().substring(
getClass().getName().length());
}
} else if (isValidInvocation(method, arguments)) {
// if listener method
-
try {
// extract value from event property name
Object[] args = getArgs(arguments);
@@ -97,81 +85,57 @@
// we have a valid listener method at this point
result = m.invoke(target, args);
} catch (Throwable t) {
- System.out.println(t.getClass() + ": " + t.getMessage()); //$NON-NLS-1$
+ System.out
+ .println(t.getClass() + ": " + t.getMessage()); //$NON-NLS-1$
}
+ }
+ }
+ }
- } // valid call
-
- } // valid object
-
- } // valid proxy
-
return result;
}
- /**
- * @com.intel.drl.spec_ref
- */
public String getListenerMethodName() {
return listenerMethodName;
}
- /**
- * @com.intel.drl.spec_ref
- */
public String getEventPropertyName() {
return eventPropertyName;
}
- /**
- * @com.intel.drl.spec_ref
- */
public String getAction() {
return action;
}
- /**
- * @com.intel.drl.spec_ref
- */
public Object getTarget() {
return target;
}
- /**
- * @com.intel.drl.spec_ref
- */
public static <T> T create(Class<T> listenerInterface, Object target,
String action, String eventPropertyName, String listenerMethodName) {
return (T) Proxy.newProxyInstance(target.getClass().getClassLoader(),
- new Class[] { listenerInterface },
- new EventHandler(target, action, eventPropertyName,
- listenerMethodName));
+ new Class[] { listenerInterface }, new EventHandler(target,
+ action, eventPropertyName, listenerMethodName));
}
- /**
- * @com.intel.drl.spec_ref
- */
public static <T> T create(Class<T> listenerInterface, Object target,
String action, String eventPropertyName) {
return (T) Proxy.newProxyInstance(target.getClass().getClassLoader(),
- new Class[] { listenerInterface },
- new EventHandler(target, action, eventPropertyName, null));
+ new Class[] { listenerInterface }, new EventHandler(target,
+ action, eventPropertyName, null));
}
- /**
- * @com.intel.drl.spec_ref
- */
public static <T> T create(Class<T> listenerInterface, Object target,
String action) {
return (T) Proxy.newProxyInstance(target.getClass().getClassLoader(),
- new Class[] { listenerInterface },
- new EventHandler(target, action, null, null));
+ new Class[] { listenerInterface }, new EventHandler(target,
+ action, null, null));
}
private boolean isValidInvocation(Method method, Object[] arguments) {
boolean result = false;
- if (listenerMethodName == null) { // all listener methods are valid
+ if (listenerMethodName == null) { // all listener methods are valid
result = true;
} else if (listenerMethodName.equals(method.getName())) {
// method's name matches
@@ -214,8 +178,8 @@
if (getter != null) {
arg = getter.invoke(arg, new Object[] {});
} else {
- throw new IntrospectionException(
- Messages.getString("beans.11", propertyName)); //$NON-NLS-1$
+ throw new IntrospectionException(Messages.getString(
+ "beans.11", propertyName)); //$NON-NLS-1$
}
} else {
Method method = findStaticGetter(arg.getClass(),
@@ -224,8 +188,8 @@
if (method != null) {
arg = method.invoke(null, new Object[] {});
} else {
- throw new IntrospectionException(
- Messages.getString("beans.12", propertyName)); //$NON-NLS-1$
+ throw new IntrospectionException(Messages.getString(
+ "beans.12", propertyName)); //$NON-NLS-1$
}
}
}
@@ -245,12 +209,10 @@
if (listenerMethodName == null) {
Class[] proxyInterfaces = proxy.getClass().getInterfaces();
- for (int i = 0; i < proxyInterfaces.length; ++i) {
- Method[] interfaceMethods = proxyInterfaces[i].getMethods();
-
- for (int k = 0; k < interfaceMethods.length; ++k) {
- Method listenerMethod = interfaceMethods[k];
+ for (Class element : proxyInterfaces) {
+ Method[] interfaceMethods = element.getMethods();
+ for (Method listenerMethod : interfaceMethods) {
if (equalNames(listenerMethod, method)
&& canInvokeWithArguments(listenerMethod, arguments)) {
found = true;
@@ -261,10 +223,9 @@
if (found) {
break;
}
-
}
- // can be invoked with a specified listener method
+ // can be invoked with a specified listener method
} else if (method.getName().equals(listenerMethodName)) {
found = true;
}
@@ -284,12 +245,11 @@
result = pd.getWriteMethod();
if (result == null) {
- throw new NoSuchMethodException(
- Messages.getString("beans.13", action)); //$NON-NLS-1$ //$NON-NLS-2$
+ throw new NoSuchMethodException(Messages.getString(
+ "beans.13", action)); //$NON-NLS-1$
}
} else {
- throw new Exception(
- Messages.getString("beans.14")); //$NON-NLS-1$
+ throw new Exception(Messages.getString("beans.14")); //$NON-NLS-1$
}
} else {
return result;
@@ -307,9 +267,9 @@
BeanInfo beanInfo = Introspector.getBeanInfo(theClass);
PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors();
- for (int i = 0; i < pds.length; ++i) {
- if (pds[i].getName().equals(propertyName)) {
- result = pds[i];
+ for (PropertyDescriptor element : pds) {
+ if (element.getName().equals(propertyName)) {
+ result = element;
break;
}
}
@@ -321,11 +281,11 @@
Method result = null;
Method[] methods = theClass.getMethods();
- for (int i = 0; i < methods.length; ++i) {
- int modifiers = methods[i].getModifiers();
+ for (Method element : methods) {
+ int modifiers = element.getModifiers();
if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers)) {
- String methodName = methods[i].getName();
+ String methodName = element.getName();
String postfix = null;
if (methodName.startsWith("get")) { //$NON-NLS-1$
@@ -336,14 +296,14 @@
continue;
}
- if ((methods[i].getParameterTypes().length != 0)
- || (methods[i].getReturnType() == void.class)) {
+ if ((element.getParameterTypes().length != 0)
+ || (element.getReturnType() == void.class)) {
continue;
}
postfix = Introspector.decapitalize(postfix);
if (postfix.equals(propertyName)) {
- result = methods[i];
+ result = element;
break;
}
}
@@ -355,10 +315,10 @@
private Method findMethod(Class<?> type, Object[] args) {
Method[] methods = type.getMethods();
- for (int i = 0; i < methods.length; ++i) {
- if (action.equals(methods[i].getName())
- && canInvokeWithArguments(methods[i], args)) {
- return methods[i];
+ for (Method element : methods) {
+ if (action.equals(element.getName())
+ && canInvokeWithArguments(element, args)) {
+ return element;
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventSetDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventSetDescriptor.java?view=diff&rev=450827&r1=450826&r2=450827
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventSetDescriptor.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/EventSetDescriptor.java Thu Sep 28 05:13:24 2006
@@ -14,10 +14,6 @@
* limitations under the License.
*/
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.9.6.3 $
- */
package java.beans;
import java.lang.reflect.Method;
@@ -29,8 +25,8 @@
public class EventSetDescriptor extends FeatureDescriptor {
- //XXX: never read
- //private String eventSetName = null;
+ // XXX: never read
+ // private String eventSetName = null;
private Class<?> listenerType = null;
@@ -46,9 +42,6 @@
private boolean inDefaultEventSet = true;
- /**
- * @com.intel.drl.spec_ref
- */
public EventSetDescriptor(Class<?> sourceClass, String eventSetName,
Class<?> listenerType, String listenerMethodName)
throws IntrospectionException {
@@ -56,13 +49,13 @@
super();
if (eventSetName == null) {
- throw new NullPointerException();
+ throw new NullPointerException();
}
setName(eventSetName);
setDisplayName(eventSetName);
- //XXX: never read
- //this.eventSetName = eventSetName;
+ // XXX: never read
+ // this.eventSetName = eventSetName;
this.listenerType = listenerType;
@@ -75,20 +68,15 @@
"", listenerType); //$NON-NLS-1$
if (addListenerMethod == null && removeListenerMethod == null) {
- throw new IntrospectionException(
- Messages.getString("beans.38")); //$NON-NLS-1$
+ throw new IntrospectionException(Messages.getString("beans.38")); //$NON-NLS-1$
}
this.getListenerMethod = findMethodByPrefix(sourceClass, "get", "s", //$NON-NLS-1$ //$NON-NLS-2$
listenerType);
this.unicast = isUnicastByDefault(addListenerMethod);
-
}
- /**
- * @com.intel.drl.spec_ref
- */
public EventSetDescriptor(Class<?> sourceClass, String eventSetName,
Class<?> listenerType, String[] listenerMethodNames,
String addListenerMethodName, String removeListenerMethodName)
@@ -97,18 +85,17 @@
setName(eventSetName);
setDisplayName(eventSetName);
-
- //XXX: never read
- //this.eventSetName = eventSetName;
+
+ // XXX: never read
+ // this.eventSetName = eventSetName;
this.listenerType = listenerType;
if (listenerMethodNames != null) {
- for (int i = 0; i < listenerMethodNames.length; ++i) {
+ for (String element : listenerMethodNames) {
try {
listenerMethodDescriptors.add(new MethodDescriptor(
- findMethodByName(listenerType,
- listenerMethodNames[i])));
+ findMethodByName(listenerType, element)));
} catch (IntrospectionException ie) {
listenerMethodDescriptors.clear();
throw ie;
@@ -123,12 +110,8 @@
this.getListenerMethod = null;
this.unicast = isUnicastByDefault(addListenerMethod);
-
}
- /**
- * @com.intel.drl.spec_ref
- */
public EventSetDescriptor(Class<?> sourceClass, String eventSetName,
Class<?> listenerType, String[] listenerMethodNames,
String addListenerMethodName, String removeListenerMethodName,
@@ -137,18 +120,17 @@
setName(eventSetName);
setDisplayName(eventSetName);
-
- //XXX: never read
- //this.eventSetName = eventSetName;
+
+ // XXX: never read
+ // this.eventSetName = eventSetName;
this.listenerType = listenerType;
if (listenerMethodNames != null) {
- for (int i = 0; i < listenerMethodNames.length; ++i) {
+ for (String element : listenerMethodNames) {
try {
listenerMethodDescriptors.add(new MethodDescriptor(
- findMethodByName(listenerType,
- listenerMethodNames[i])));
+ findMethodByName(listenerType, element)));
} catch (IntrospectionException ie) {
listenerMethodDescriptors.clear();
throw ie;
@@ -164,12 +146,8 @@
getListenerMethodName);
this.unicast = isUnicastByDefault(addListenerMethod);
-
}
- /**
- * @com.intel.drl.spec_ref
- */
public EventSetDescriptor(String eventSetName, Class<?> listenerType,
Method[] listenerMethods, Method addListenerMethod,
Method removeListenerMethod) throws IntrospectionException {
@@ -178,16 +156,16 @@
setName(eventSetName);
setDisplayName(eventSetName);
- //XXX: never read
- //this.eventSetName = eventSetName;
+ // XXX: never read
+ // this.eventSetName = eventSetName;
this.listenerType = listenerType;
if (listenerMethods != null) {
- for (int i = 0; i < listenerMethods.length; ++i) {
- if (checkMethod(listenerType, listenerMethods[i])) {
+ for (Method element : listenerMethods) {
+ if (checkMethod(listenerType, element)) {
this.listenerMethodDescriptors.add(new MethodDescriptor(
- listenerMethods[i]));
+ element));
}
}
}
@@ -199,12 +177,8 @@
this.getListenerMethod = null;
this.unicast = isUnicastByDefault(addListenerMethod);
-
}
- /**
- * @com.intel.drl.spec_ref
- */
public EventSetDescriptor(String eventSetName, Class<?> listenerType,
Method[] listenerMethods, Method addListenerMethod,
Method removeListenerMethod, Method getListenerMethod)
@@ -214,17 +188,17 @@
setName(eventSetName);
setDisplayName(eventSetName);
-
- //XXX: never read
- //this.eventSetName = eventSetName;
+
+ // XXX: never read
+ // this.eventSetName = eventSetName;
this.listenerType = listenerType;
if (listenerMethods != null) {
- for (int i = 0; i < listenerMethods.length; ++i) {
- if (checkMethod(listenerType, listenerMethods[i])) {
+ for (Method element : listenerMethods) {
+ if (checkMethod(listenerType, element)) {
this.listenerMethodDescriptors.add(new MethodDescriptor(
- listenerMethods[i]));
+ element));
}
}
}
@@ -237,12 +211,8 @@
getListenerMethod);
this.unicast = isUnicastByDefault(addListenerMethod);
-
}
- /**
- * @com.intel.drl.spec_ref
- */
public EventSetDescriptor(String eventSetName, Class<?> listenerType,
MethodDescriptor[] listenerMethodDescriptors,
Method addListenerMethod, Method removeListenerMethod)
@@ -251,18 +221,17 @@
setName(eventSetName);
setDisplayName(eventSetName);
-
- //XXX: never read
- //this.eventSetName = eventSetName;
+
+ // XXX: never read
+ // this.eventSetName = eventSetName;
this.listenerType = listenerType;
- for (int i = 0; i < listenerMethodDescriptors.length; ++i) {
- Method listenerMethod = listenerMethodDescriptors[i].getMethod();
+ for (MethodDescriptor element : listenerMethodDescriptors) {
+ Method listenerMethod = element.getMethod();
if (checkMethod(listenerType, listenerMethod)) {
- this.listenerMethodDescriptors
- .add(listenerMethodDescriptors[i]);
+ this.listenerMethodDescriptors.add(element);
}
}
@@ -275,9 +244,6 @@
this.unicast = isUnicastByDefault(addListenerMethod);
}
- /**
- * @com.intel.drl.spec_ref
- */
public Method[] getListenerMethods() {
Method[] result = new Method[listenerMethodDescriptors.size()];
Iterator<MethodDescriptor> i = listenerMethodDescriptors.iterator();
@@ -292,9 +258,6 @@
return result;
}
- /**
- * @com.intel.drl.spec_ref
- */
public MethodDescriptor[] getListenerMethodDescriptors() {
MethodDescriptor[] result = new MethodDescriptor[listenerMethodDescriptors
.size()];
@@ -308,58 +271,34 @@
return result;
}
- /**
- * @com.intel.drl.spec_ref
- */
public Method getRemoveListenerMethod() {
return removeListenerMethod;
}
- /**
- * @com.intel.drl.spec_ref
- */
public Method getGetListenerMethod() {
return getListenerMethod;
}
- /**
- * @com.intel.drl.spec_ref
- */
public Method getAddListenerMethod() {
return addListenerMethod;
}
- /**
- * @com.intel.drl.spec_ref
- */
public Class<?> getListenerType() {
return listenerType;
}
- /**
- * @com.intel.drl.spec_ref
- */
public void setUnicast(boolean unicast) {
this.unicast = unicast;
}
- /**
- * @com.intel.drl.spec_ref
- */
public void setInDefaultEventSet(boolean inDefaultEventSet) {
this.inDefaultEventSet = inDefaultEventSet;
}
- /**
- * @com.intel.drl.spec_ref
- */
public boolean isUnicast() {
return unicast;
}
- /**
- * @com.intel.drl.spec_ref
- */
public boolean isInDefaultEventSet() {
return inDefaultEventSet;
}
@@ -395,19 +334,18 @@
new Class[] { getEventType(listenerType) });
} catch (NoSuchMethodException nsme) {
throw new IntrospectionException(Messages.getString("beans.31", //$NON-NLS-1$
- listenerMethodName, listenerType.getName())); //$NON-NLS-1$
+ listenerMethodName, listenerType.getName()));
} catch (ClassNotFoundException cnfe) {
- throw new IntrospectionException(Messages.getString("beans.32", listenerType.getName())); //$NON-NLS-1$
+ throw new IntrospectionException(Messages.getString(
+ "beans.32", listenerType.getName())); //$NON-NLS-1$
}
}
private Method findMethodByPrefix(Class<?> sourceClass, String prefix,
String postfix, Class<?> listenerType) {
- // com.drl.beans.SmthListener
String fullName = listenerType.getName();
int idx = fullName.lastIndexOf("."); //$NON-NLS-1$
- // prefix(e.g., add) + SmthListener
String methodName = prefix + fullName.substring(idx + 1) + postfix;
try {
@@ -427,8 +365,8 @@
if (addMethod != null) {
Class[] exceptionTypes = addMethod.getExceptionTypes();
- for (int i = 0; i < exceptionTypes.length; ++i) {
- if (exceptionTypes[i].equals(TooManyListenersException.class)) {
+ for (Class element : exceptionTypes) {
+ if (element.equals(TooManyListenersException.class)) {
return true;
}
}
@@ -445,17 +383,17 @@
Class[] parameterTypes;
if (returnType != void.class) {
- throw new IntrospectionException(
- Messages.getString("beans.33", registrationMethod.getName())); //$NON-NLS-1$
+ throw new IntrospectionException(Messages.getString(
+ "beans.33", registrationMethod.getName())); //$NON-NLS-1$
}
parameterTypes = registrationMethod.getParameterTypes();
if (parameterTypes == null || parameterTypes.length != 1) {
- throw new IntrospectionException(
- Messages.getString("beans.34", registrationMethod.getName())); //$NON-NLS-1$
+ throw new IntrospectionException(Messages.getString(
+ "beans.34", registrationMethod.getName())); //$NON-NLS-1$
} else if (parameterTypes[0] != listenerType) {
- throw new IntrospectionException(
- Messages.getString("beans.35", listenerType.getName())); //$NON-NLS-1$
+ throw new IntrospectionException(Messages.getString(
+ "beans.35", listenerType.getName())); //$NON-NLS-1$
} else {
return registrationMethod;
}
@@ -471,8 +409,7 @@
Class<?> returnType;
if (parameterTypes.length != 0) {
- throw new IntrospectionException(
- Messages.getString("beans.36")); //$NON-NLS-1$
+ throw new IntrospectionException(Messages.getString("beans.36")); //$NON-NLS-1$
}
returnType = getListenerMethod.getReturnType();
@@ -480,8 +417,7 @@
&& returnType.getComponentType() == listenerType) {
return getListenerMethod;
} else {
- throw new IntrospectionException(
- Messages.getString("beans.37")); //$NON-NLS-1$
+ throw new IntrospectionException(Messages.getString("beans.37")); //$NON-NLS-1$
}
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/ExceptionListener.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/ExceptionListener.java?view=diff&rev=450827&r1=450826&r2=450827
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/ExceptionListener.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/ExceptionListener.java Thu Sep 28 05:13:24 2006
@@ -14,21 +14,9 @@
* 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 interface ExceptionListener {
- /**
- * @com.intel.drl.spec_ref
- */
public void exceptionThrown(Exception e);
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Expression.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Expression.java?view=diff&rev=450827&r1=450826&r2=450827
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Expression.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Expression.java Thu Sep 28 05:13:24 2006
@@ -14,53 +14,34 @@
* limitations under the License.
*/
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.7.6.3 $
- */
package java.beans;
import org.apache.harmony.beans.internal.nls.Messages;
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.7.6.3 $
- */
-
public class Expression extends Statement {
-
+
boolean valueIsDefined = false;
+
Object value;
- /**
- * @com.intel.drl.spec_ref
- */
- public Expression(
- Object value,
- Object target,
- String methodName,
+ public Expression(Object value, Object target, String methodName,
Object[] arguments) {
super(target, methodName, arguments);
this.value = value;
this.valueIsDefined = true;
}
- /**
- * @com.intel.drl.spec_ref
- */
public Expression(Object target, String methodName, Object[] arguments) {
super(target, methodName, arguments);
this.value = null;
this.valueIsDefined = false;
}
- /**
- * @com.intel.drl.spec_ref
- */
+ @Override
public String toString() {
try {
StringBuilder sb = new StringBuilder();
-
+
if (!valueIsDefined) {
sb.append("<unbound>"); //$NON-NLS-1$
} else {
@@ -72,26 +53,20 @@
}
sb.append('=');
sb.append(super.toString());
-
+
return sb.toString();
- } catch(Exception e) {
+ } catch (Exception e) {
return new String(Messages.getString("beans.0D", e.getClass())); //$NON-NLS-1$
}
}
- /**
- * @com.intel.drl.spec_ref
- */
public void setValue(Object value) {
this.value = value;
this.valueIsDefined = true;
}
- /**
- * @com.intel.drl.spec_ref
- */
public Object getValue() throws Exception {
- if((value == null) && !valueIsDefined) {
+ if ((value == null) && !valueIsDefined) {
value = invokeMethod();
}
return value;
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?view=diff&rev=450827&r1=450826&r2=450827
==============================================================================
--- 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 Thu Sep 28 05:13:24 2006
@@ -14,6 +14,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
+
package java.beans;
import java.util.Collections;
@@ -24,8 +25,6 @@
/**
* Common base class for Descriptors.
- *
- * @author Maxim V. Berkultsev
*/
public class FeatureDescriptor {
@@ -53,12 +52,15 @@
* Sets the value for the named attribute.
* </p>
*
- * @param attributeName The name of the attribute to set a value with.
- * @param value The value to set.
+ * @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)
+ if (attributeName == null || value == null) {
throw new NullPointerException();
+ }
values.put(attributeName, value);
}
@@ -67,7 +69,8 @@
* Gets the value associated with the named attribute.
* </p>
*
- * @param attributeName The name of the attribute to get a value for.
+ * @param attributeName
+ * The name of the attribute to get a value for.
* @return The attribute's value.
*/
public Object getValue(String attributeName) {
@@ -86,7 +89,7 @@
* @return An instance of {@link Enumeration}.
*/
public Enumeration<String> attributeNames() {
- //Create a new list, so that the references are copied
+ // Create a new list, so that the references are copied
return Collections.enumeration(new LinkedList<String>(values.keySet()));
}
@@ -95,7 +98,8 @@
* Sets the short description.
* </p>
*
- * @param text The description to set.
+ * @param text
+ * The description to set.
*/
public void setShortDescription(String text) {
this.shortDescription = text;
@@ -106,7 +110,8 @@
* Sets the name.
* </p>
*
- * @param name The name to set.
+ * @param name
+ * The name to set.
*/
public void setName(String name) {
this.name = name;
@@ -117,7 +122,8 @@
* Sets the display name.
* </p>
*
- * @param displayName The display name to set.
+ * @param displayName
+ * The display name to set.
*/
public void setDisplayName(String displayName) {
this.displayName = displayName;
@@ -161,8 +167,9 @@
* Sets the preferred indicator.
* </p>
*
- * @param preferred <code>true</code> if preferred, <code>false</code>
- * otherwise.
+ * @param preferred
+ * <code>true</code> if preferred, <code>false</code>
+ * otherwise.
*/
public void setPreferred(boolean preferred) {
this.preferred = preferred;
@@ -173,8 +180,8 @@
* Sets the hidden indicator.
* </p>
*
- * @param hidden <code>true</code> if hidden, <code>false</code>
- * otherwise.
+ * @param hidden
+ * <code>true</code> if hidden, <code>false</code> otherwise.
*/
public void setHidden(boolean hidden) {
this.hidden = hidden;
@@ -185,8 +192,8 @@
* Sets the expert indicator.
* </p>
*
- * @param expert <code>true</code> if expert, <code>false</code>
- * otherwise.
+ * @param expert
+ * <code>true</code> if expert, <code>false</code> otherwise.
*/
public void setExpert(boolean expert) {
this.expert = expert;
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/IndexedPropertyChangeEvent.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/IndexedPropertyChangeEvent.java?view=diff&rev=450827&r1=450826&r2=450827
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/IndexedPropertyChangeEvent.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/IndexedPropertyChangeEvent.java Thu Sep 28 05:13:24 2006
@@ -25,42 +25,42 @@
*/
public class IndexedPropertyChangeEvent extends PropertyChangeEvent {
- private static final long serialVersionUID = -320227448495806870L;
+ private static final long serialVersionUID = -320227448495806870L;
- private final int index;
+ private final int index;
- /**
- * Creates a new property changed event with an indication of the property
- * index.
- *
- * @param source
- * the changed bean.
- * @param propertyName
- * the changed property, or <code>null</code> to indicate an
- * unspecified set of the properties have changed.
- * @param oldValue
- * the previous value of the property, or <code>null</code> if
- * the <code>propertyName</code> is <code>null</code> or the
- * previous value is unknown.
- * @param newValue
- * the new value of the property, or <code>null</code> if the
- * <code>propertyName</code> is <code>null</code> or the new
- * value is unknown..
- * @param index
- * the index of the property.
- */
- public IndexedPropertyChangeEvent(Object source, String propertyName,
- Object oldValue, Object newValue, int index) {
- super(source, propertyName, oldValue, newValue);
- this.index = index;
- }
+ /**
+ * Creates a new property changed event with an indication of the property
+ * index.
+ *
+ * @param source
+ * the changed bean.
+ * @param propertyName
+ * the changed property, or <code>null</code> to indicate an
+ * unspecified set of the properties have changed.
+ * @param oldValue
+ * the previous value of the property, or <code>null</code> if
+ * the <code>propertyName</code> is <code>null</code> or the
+ * previous value is unknown.
+ * @param newValue
+ * the new value of the property, or <code>null</code> if the
+ * <code>propertyName</code> is <code>null</code> or the new
+ * value is unknown..
+ * @param index
+ * the index of the property.
+ */
+ public IndexedPropertyChangeEvent(Object source, String propertyName,
+ Object oldValue, Object newValue, int index) {
+ super(source, propertyName, oldValue, newValue);
+ this.index = index;
+ }
- /**
- * Answer the index of the property that was changed in this event.
- *
- * @return The property element index.
- */
- public int getIndex() {
- return index;
- }
+ /**
+ * Answer the index of the property that was changed in this event.
+ *
+ * @return The property element index.
+ */
+ public int getIndex() {
+ return index;
+ }
}