harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r420762 - in /incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java: java/beans/Encoder.java java/beans/EventHandler.java java/beans/EventSetDescriptor.java org/apache/harmony/beans/ObjectNode.java
Date Tue, 11 Jul 2006 08:38:04 GMT
Author: mloenko
Date: Tue Jul 11 01:38:04 2006
New Revision: 420762

URL: http://svn.apache.org/viewvc?rev=420762&view=rev
Log:
fixing style in some beans classes, applied patch from HARMONY-820
[classlib][beans] beautifying of java.beans classes (2)
applied autoformatter

Modified:
    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/org/apache/harmony/beans/ObjectNode.java

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?rev=420762&r1=420761&r2=420762&view=diff
==============================================================================
--- 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 Tue Jul 11 01:38:04 2006
@@ -28,36 +28,30 @@
 import org.apache.harmony.beans.ObjectNode;
 import org.apache.harmony.beans.DefaultPersistenceDelegatesFactory;
 
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.14.6.4 $
- */
-
 public class Encoder {
-    
+
     private ExceptionListener exceptionListener = null;
-    private HashMap<Class<?>, PersistenceDelegate> persistenceDelegates =
-        new HashMap<Class<?>, PersistenceDelegate>();
-    
+
+    private HashMap<Class<?>, PersistenceDelegate> persistenceDelegates = new HashMap<Class<?>, PersistenceDelegate>();
+
     Vector<Object> roots = new Vector<Object>();
+
     HashMap<Object, ObjectNode> nodes = new HashMap<Object, ObjectNode>();
-    
+
     /**
      * @com.intel.drl.spec_ref
      */
     public Encoder() {}
-    
+
     /**
      * @com.intel.drl.spec_ref
      */
     public Object get(Object oldInstance) {
-        if(oldInstance == null) {
+        if (oldInstance == null) {
             return null;
         }
-        
-        ObjectNode node = (ObjectNode) nodes.get(oldInstance);
-        Object result = getValue(node);
-        return result;
+
+        return getValue(nodes.get(oldInstance));
     }
 
     /**
@@ -65,26 +59,24 @@
      */
     public Object remove(Object oldInstance) {
         //TODO - notify references on node deletion
-        if(oldInstance == null) {
+        if (oldInstance == null) {
             return null;
         }
-        
-        ObjectNode node = (ObjectNode) nodes.remove(oldInstance);
-        return getValue(node);
+
+        return getValue(nodes.remove(oldInstance));
     }
-    
+
     /**
      * @com.intel.drl.spec_ref
      */
     public PersistenceDelegate getPersistenceDelegate(Class<?> type) {
-        PersistenceDelegate result =
-                (PersistenceDelegate) persistenceDelegates.get(type);
-        
-        if(result == null) {
-             result = DefaultPersistenceDelegatesFactory.getPersistenceDelegate(
-                     type);
+        PersistenceDelegate result = persistenceDelegates.get(type);
+
+        if (result == null) {
+            result = DefaultPersistenceDelegatesFactory
+                    .getPersistenceDelegate(type);
         }
-        
+
         return result;
     }
 
@@ -103,26 +95,26 @@
         roots.add(object);
         doWriteObject(object);
     }
-    
-    void doWriteObject(Object object) {
-           PersistenceDelegate pd = (object != null) ?
-               getPersistenceDelegate(object.getClass()) :
-                   new NullPersistenceDelegate();
 
+    void doWriteObject(Object object) {
+        PersistenceDelegate pd = (object != null) ? 
+                getPersistenceDelegate(object.getClass())
+                : new NullPersistenceDelegate();
 
-           if(pd == null) {
-               pd = new DefaultPersistenceDelegate();
-           }
+        if (pd == null) {
+            pd = new DefaultPersistenceDelegate();
+        }
 
-           pd.writeObject(object, this);
+        pd.writeObject(object, this);
     }
 
     /**
      * @com.intel.drl.spec_ref
      */
     public void writeStatement(Statement oldStm) {
-        ObjectNode node = (ObjectNode) nodes.get(oldStm.getTarget());
-        if(node != null) {
+        ObjectNode node = nodes.get(oldStm.getTarget());
+
+        if (node != null) {
             try {
                 Object[] oldArgs = oldStm.getArguments();
                 write(oldArgs);
@@ -145,20 +137,19 @@
     public void writeExpression(Expression oldExp) {
         try {
             Object oldInstance = oldExp.getValue();
-            
+
             ObjectNode node = null;
             Class<?> type = null;
 
-            if(oldInstance != null) {
+            if (oldInstance != null) {
                 type = oldInstance.getClass();
-                node = (ObjectNode) nodes.get(oldInstance);
+                node = nodes.get(oldInstance);
             }
-            
-            if(node == null) {
-                if(isNull(type) || isPrimitive(type) || isString(type)
-                        //|| isClass(type)
-                   ) 
-                {
+
+            if (node == null) {
+                if (isNull(type) || isPrimitive(type) || isString(type)
+                //|| isClass(type)
+                ) {
                     node = new ObjectNode(oldExp);
                 } else {
                     write(oldExp.getArguments());
@@ -168,14 +159,12 @@
                 nodes.put(oldInstance, node);
 
                 // if an expression is not a constructor
-                if(!(oldExp.getTarget() instanceof Class ||
-                     oldExp.getTarget() instanceof Field))
-                {
-                    ObjectNode parent = (ObjectNode) nodes.get(
-                            oldExp.getTarget());
+                if (!(oldExp.getTarget() instanceof Class || oldExp.getTarget() instanceof Field)) {
+                    ObjectNode parent = nodes.get(oldExp.getTarget());
+
                     parent.addExpression(oldExp);
                 }
-            } else if(oldExp.getMethodName().equals("new")) {
+            } else if (oldExp.getMethodName().equals("new")) {
                 node.addReference();
             } else {
                 node.addReferencedExpression(oldExp);
@@ -197,112 +186,111 @@
      * @com.intel.drl.spec_ref
      */
     public ExceptionListener getExceptionListener() {
-        if(exceptionListener == null) {
+        if (exceptionListener == null) {
             exceptionListener = new ExceptionListener() {
+
                 public void exceptionThrown(Exception e) {
                     System.out.println(e.getClass() + ": " + e.getMessage());
                 }
             };
         }
-        
+
         return exceptionListener;
     }
-    
+
     private Object write(Object oldInstance) throws Exception {
-        if(oldInstance == null) {
+        if (oldInstance == null) {
             return null;
         }
 
-        ObjectNode node = (ObjectNode) nodes.get(oldInstance);
-        if(node == null) {
-            Class<?> type = oldInstance.getClass();
-            
+        ObjectNode node = nodes.get(oldInstance);
+        if (node == null) {
+            //XXX type is never used
+            //Class<?> type = oldInstance.getClass();
+
             doWriteObject(oldInstance);
-            node = (ObjectNode) nodes.get(oldInstance);
+            node = nodes.get(oldInstance);
         } else {
             node.addReference();
         }
-        
+
         return node.getObjectValue();
     }
-    
+
     private Object[] write(Object[] oldInstances) throws Exception {
-        if(oldInstances != null) {
+        if (oldInstances != null) {
             Object[] newInstances = new Object[oldInstances.length];
-            
-            for(int i = 0; i < oldInstances.length; ++i) {
+
+            for (int i = 0; i < oldInstances.length; ++i) {
                 newInstances[i] = write(oldInstances[i]);
             }
-            
             return newInstances;
         }
-        
         return null;
     }
 
     private Object getValue(ObjectNode node) {
-        if(node != null) {
+        if (node != null) {
             try {
                 Object result = node.getObjectValue();
+
                 return result;
             } catch (Exception e) {
                 getExceptionListener().exceptionThrown(e);
             }
         }
-        
         return null;
     }
-    
+
     static boolean isNull(Class<?> type) {
-        return (type == null);
+        return type == null;
     }
-    
+
     static boolean isPrimitive(Class<?> type) {
-        return (type == Boolean.class) || (type == Byte.class) ||
-            (type == Character.class) || (type == Double.class) ||
-            (type == Float.class) || (type == Integer.class) ||
-            (type == Long.class) || (type == Short.class);
+        return type == Boolean.class || type == Byte.class
+                || type == Character.class || type == Double.class
+                || type == Float.class || type == Integer.class
+                || type == Long.class || type == Short.class;
     }
-    
+
     static boolean isString(Class<?> type) {
-        return (type == String.class);
-        
+        return type == String.class;
+
     }
-    
+
     static boolean isClass(Class<?> type) {
-        return (type == Class.class);
+        return type == Class.class;
     }
-    
-    
+
     static boolean isArray(Class<?> type) {
         return type.isArray();
     }
-    
+
     static String getPrimitiveName(Class<?> type) {
         String result = null;
-        
-        if(type == Boolean.class) {
+
+        if (type == Boolean.class) {
             result = "boolean";
-        } else if(type == Byte.class) {
+        } else if (type == Byte.class) {
             result = "byte";
-        } else if(type == Character.class) {
+        } else if (type == Character.class) {
             result = "char";
-        } else if(type == Double.class) {
+        } else if (type == Double.class) {
             result = "double";
-        } else if(type == Float.class) {
+        } else if (type == Float.class) {
             result = "float";
-        } else if(type == Integer.class) {
+        } else if (type == Integer.class) {
             result = "int";
-        } else if(type == Long.class) {
+        } else if (type == Long.class) {
             result = "long";
-        } else if(type == Short.class) {
+        } else if (type == Short.class) {
             result = "short";
-        } else if(type == String.class) {
+        } else if (type == String.class) {
             result = "string";
-        } else if(type == Class.class) {
+        } else if (type == Class.class) {
             result = "class";
         }
-        
+
         return result;
     }
 }

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?rev=420762&r1=420761&r2=420762&view=diff
==============================================================================
--- 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 Tue Jul 11 01:38:04 2006
@@ -26,16 +26,14 @@
 import java.lang.reflect.Proxy;
 import java.util.StringTokenizer;
 
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.7.6.3 $
- */
-
 public class EventHandler implements InvocationHandler {
-    
+
     private Object target;
+
     private String action;
+
     private String eventPropertyName;
+
     private String listenerMethodName;
 
     /**
@@ -55,20 +53,24 @@
     public Object invoke(Object proxy, Method method, Object[] arguments) {
         // workaround if arguments are null - treat them as array with
         // single null element
-        if(arguments == null) {
+        if (arguments == null) {
             arguments = new Object[] { null };
         }
-        
+
         Class<?> proxyClass = proxy.getClass();
         // if a proxy
-        if(Proxy.isProxyClass(proxyClass)) {
+        if (Proxy.isProxyClass(proxyClass)) {
             InvocationHandler handler = Proxy.getInvocationHandler(proxy);
+
             // if a valid object
-            if((handler instanceof EventHandler) && isValidInvocation(method,
-                    arguments)) {
+            if ((handler instanceof EventHandler)
+                    && isValidInvocation(method, arguments)) {
                 try {
-                    Object[] args = getArgs(arguments); // extract value from event property name
-                    Method m = getMethod(proxy, method, arguments, args); // extract method to be invoked on target
+                    // extract value from event property name
+                    Object[] args = getArgs(arguments);
+                    // extract method to be invoked on target
+                    Method m = getMethod(proxy, method, arguments, args);
+
                     return m.invoke(target, args);
                 } catch (Throwable t) {
                     System.out.println(t.getClass() + ": " + t.getMessage());
@@ -88,7 +90,7 @@
      * @com.intel.drl.spec_ref
      */
     public String getListenerMethodName() {
-        return listenerMethodName; 
+        return listenerMethodName;
     }
 
     /**
@@ -115,53 +117,47 @@
     /**
      * @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));
+    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));
     }
 
     /**
      * @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));
+    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));
     }
 
     /**
      * @com.intel.drl.spec_ref
      */
-    public static <T> T create(
-            Class<T> listenerInterface,
-            Object target,
+    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));
+        return (T) Proxy.newProxyInstance(target.getClass().getClassLoader(),
+                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
+        } else if (listenerMethodName.equals(method.getName())) {
+            // method's name matches
             // no arguments in call are valid
-            if((eventPropertyName == null) && ((arguments == null)
-                    || (arguments.length == 0))) {
+            if ((eventPropertyName == null)
+                    && ((arguments == null) || (arguments.length == 0))) {
                 result = true;
-            // one-argument call is value
+                // one-argument call is value
             } else if ((eventPropertyName != null) && (arguments != null)
-                    && (arguments.length == 1)){
+                    && (arguments.length == 1)) {
                 result = true;
             } else {
                 result = false;
@@ -169,12 +165,12 @@
         } else {
             result = false;
         }
-        
+
         return result;
     }
-    
+
     private Object[] getArgs(Object[] arguments) throws Exception {
-        if(eventPropertyName == null) {
+        if (eventPropertyName == null) {
             return new Object[] {};
         } else if ((arguments == null) || (arguments.length == 0)
                 || (arguments[0] == null)) {
@@ -182,95 +178,92 @@
         } else {
             Object arg = arguments[0];
             StringTokenizer st = new StringTokenizer(eventPropertyName, ".");
-            
-            while(st.hasMoreTokens()) {
+
+            while (st.hasMoreTokens()) {
                 String propertyName = st.nextToken();
                 PropertyDescriptor pd = findPropertyDescriptor(arg.getClass(),
                         propertyName);
-                
-                if(pd != null) {
+
+                if (pd != null) {
                     Method getter = pd.getReadMethod();
-                    
-                    if(getter != null) {
+
+                    if (getter != null) {
                         arg = getter.invoke(arg, new Object[] {});
                     } else {
                         throw new IntrospectionException(
-                            "no getter for property " + propertyName
-                            + " found");
+                                "no getter for property " + propertyName
+                                        + " found");
                     }
                 } else {
                     Method method = findStaticGetter(arg.getClass(),
                             propertyName);
-                    
-                    if(method != null) {
+
+                    if (method != null) {
                         arg = method.invoke(null, new Object[] {});
                     } else {
                         throw new IntrospectionException(
-                            "cannot access property " + propertyName
-                            + " getter");
+                                "cannot access property " + propertyName
+                                        + " getter");
                     }
                 }
             }
             return new Object[] { arg };
         }
     }
-    
-    private Method getMethod(
-            Object proxy,
-            Method method,
-            Object[] arguments,
+
+    private Method getMethod(Object proxy, Method method, Object[] arguments,
             Object[] args) throws Exception {
         Method result = null;
-        
+
         // filtering - examine if the 'method' could be applied to proxy
-        
+
         boolean found = false;
 
         // can be invoke with any listener method
-        if(listenerMethodName == null) {
+        if (listenerMethodName == null) {
             Class[] proxyInterfaces = proxy.getClass().getInterfaces();
-            
-            for(int i = 0; i < proxyInterfaces.length; ++i) {
+
+            for (int i = 0; i < proxyInterfaces.length; ++i) {
                 Method[] interfaceMethods = proxyInterfaces[i].getMethods();
-                
-                for(int k = 0; k < interfaceMethods.length; ++k) {
+
+                for (int k = 0; k < interfaceMethods.length; ++k) {
                     Method listenerMethod = interfaceMethods[k];
-                    
-                    if(equalNames(listenerMethod, method)
-                            && canInvokeWithArguments(listenerMethod,
-                                    arguments)) {
+
+                    if (equalNames(listenerMethod, method)
+                            && canInvokeWithArguments(listenerMethod, arguments)) {
                         found = true;
                         break;
                     }
                 }
-                
-                if(found) {
+
+                if (found) {
                     break;
                 }
-                
+
             }
-            
-        // can be invoked with a specified listener method    
-        } else if(method.getName().equals(listenerMethodName)){
+
+            // can be invoked with a specified listener method    
+        } else if (method.getName().equals(listenerMethodName)) {
             found = true;
         }
-        
-        if(found == false) {
+
+        if (found == false) {
             return null;
         }
-        
+
         // 'Method' can be applied to proxy - filtering succeeded
         try {
             result = findMethod(target.getClass(), args);
-            if(result == null) {
-                PropertyDescriptor pd = findPropertyDescriptor(
-                        target.getClass(), action);
-                if(pd != null) {
+            if (result == null) {
+                PropertyDescriptor pd = findPropertyDescriptor(target
+                        .getClass(), action);
+
+                if (pd != null) {
                     result = pd.getWriteMethod();
-                    
-                    if(result == null) {
+
+                    if (result == null) {
                         throw new NoSuchMethodException(
-                            "no setter for property " + action + " found");
+                                "no setter for property " + action + " found");
                     }
                 } else {
                     throw new Exception(
@@ -282,55 +275,52 @@
         } catch (IntrospectionException ie) {
             throw new Exception("Exception while finding property descriptor");
         }
-        
+
         return result;
     }
-    
-    private PropertyDescriptor findPropertyDescriptor(
-        Class<?> theClass, String propertyName) throws IntrospectionException
-    {
+
+    private PropertyDescriptor findPropertyDescriptor(Class<?> theClass,
+            String propertyName) throws IntrospectionException {
         PropertyDescriptor result = null;
         BeanInfo beanInfo = Introspector.getBeanInfo(theClass);
         PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors();
-        for(int i = 0; i < pds.length; ++i) {
-            if(pds[i].getName().equals(propertyName)) {
+
+        for (int i = 0; i < pds.length; ++i) {
+            if (pds[i].getName().equals(propertyName)) {
                 result = pds[i];
                 break;
             }
         }
         return result;
     }
-    
-    private Method findStaticGetter(
-        Class<?> theClass, String propertyName) throws IntrospectionException
-    {
+
+    private Method findStaticGetter(Class<?> theClass, String propertyName)
+            throws IntrospectionException {
         Method result = null;
-        
         Method[] methods = theClass.getMethods();
-        for(int i = 0; i < methods.length; ++i) {
+
+        for (int i = 0; i < methods.length; ++i) {
             int modifiers = methods[i].getModifiers();
-            
-            if(Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers)) {
+
+            if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers)) {
                 String methodName = methods[i].getName();
                 String postfix = null;
-                
-                if(methodName.startsWith("get")) {
+
+                if (methodName.startsWith("get")) {
                     postfix = methodName.substring(3);
-                } else if(methodName.startsWith("is")) {
+                } else if (methodName.startsWith("is")) {
                     postfix = methodName.substring(2);
                 } else {
                     continue;
                 }
-                
-                if(
-                    (methods[i].getParameterTypes().length != 0) ||
-                    (methods[i].getReturnType() == void.class)
-                ) {
+
+                if ((methods[i].getParameterTypes().length != 0)
+                        || (methods[i].getReturnType() == void.class)) {
                     continue;
                 }
-                
+
                 postfix = Introspector.decapitalize(postfix);
-                if(postfix.equals(propertyName)) {
+                if (postfix.equals(propertyName)) {
                     result = methods[i];
                     break;
                 }
@@ -339,53 +329,54 @@
 
         return result;
     }
-    
+
     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)) {
+
+        for (int i = 0; i < methods.length; ++i) {
+            if (action.equals(methods[i].getName())
+                    && canInvokeWithArguments(methods[i], args)) {
                 return methods[i];
             }
         }
-        
+
         return null;
     }
-    
+
     private static boolean isPrimitiveWrapper(Class<?> wrapper, Class<?> base) {
-        return (base == boolean.class) && (wrapper == Boolean.class) ||
-            (base == byte.class) && (wrapper == Byte.class) ||
-            (base == char.class) && (wrapper == Character.class) ||
-            (base == short.class) && (wrapper == Short.class) ||
-            (base == int.class) && (wrapper == Integer.class) ||
-            (base == long.class) && (wrapper == Long.class) ||
-            (base == float.class) && (wrapper == Float.class) ||
-            (base == double.class) && (wrapper == Double.class);
+        return (base == boolean.class) && (wrapper == Boolean.class)
+                || (base == byte.class) && (wrapper == Byte.class)
+                || (base == char.class) && (wrapper == Character.class)
+                || (base == short.class) && (wrapper == Short.class)
+                || (base == int.class) && (wrapper == Integer.class)
+                || (base == long.class) && (wrapper == Long.class)
+                || (base == float.class) && (wrapper == Float.class)
+                || (base == double.class) && (wrapper == Double.class);
     }
-    
+
     private static boolean canInvokeWithArguments(Method m, Object[] arguments) {
         Class[] parameterTypes = m.getParameterTypes();
-        
-        if(parameterTypes.length == arguments.length) {
-            for(int i = 0; i < arguments.length; ++i) {
+
+        if (parameterTypes.length == arguments.length) {
+            for (int i = 0; i < arguments.length; ++i) {
                 Class<?> argumentType = (arguments[i] == null) ? null
                         : arguments[i].getClass();
-                if((argumentType == null) || isPrimitiveWrapper(argumentType,
-                        parameterTypes[i])) {
+
+                if ((argumentType == null)
+                        || isPrimitiveWrapper(argumentType, parameterTypes[i])) {
                     // ... nothing to do - just not to break the cycle
-                } else if(!argumentType.isAssignableFrom(parameterTypes[i])) {
+                } else if (!argumentType.isAssignableFrom(parameterTypes[i])) {
                     return false;
                 }
             }
         } else {
             return false;
         }
-        
+
         return true;
-        
+
     }
-    
+
     private static boolean equalNames(Method m1, Method m2) {
         return m1.getName().equals(m2.getName());
     }

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?rev=420762&r1=420761&r2=420762&view=diff
==============================================================================
--- 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 Tue Jul 11 01:38:04 2006
@@ -25,80 +25,85 @@
 import java.util.Iterator;
 import java.util.TooManyListenersException;
 
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.9.6.3 $
- */
-
 public class EventSetDescriptor extends FeatureDescriptor {
 
-    private String eventSetName = null;
-    
+    //XXX: never read
+    //private String eventSetName = null;
+
     private Class<?> listenerType = null;
-    private ArrayList<MethodDescriptor> listenerMethodDescriptors =
-        new ArrayList<MethodDescriptor>();
-    
+
+    private ArrayList<MethodDescriptor> listenerMethodDescriptors = new ArrayList<MethodDescriptor>();
+
     private Method getListenerMethod = null;
+
     private Method addListenerMethod = null;
+
     private Method removeListenerMethod = null;
-    
+
     private boolean unicast = false;
+
     private boolean inDefaultEventSet = true;
 
     /**
      * @com.intel.drl.spec_ref
-    */
+     */
     public EventSetDescriptor(Class<?> sourceClass, String eventSetName,
-        Class<?> listenerType, String listenerMethodName
-    ) throws IntrospectionException {
-        
+            Class<?> listenerType, String listenerMethodName)
+            throws IntrospectionException {
+
         super();
-        
+
         setName(eventSetName);
         setDisplayName(eventSetName);
-        this.eventSetName = eventSetName;
+
+        //XXX: never read
+        //this.eventSetName = eventSetName;
+
         this.listenerType = listenerType;
-        
-        this.listenerMethodDescriptors.add(
-            new MethodDescriptor(findMethodByName(listenerType,
-                    listenerMethodName)));
-        
+
+        this.listenerMethodDescriptors.add(new MethodDescriptor(
+                findMethodByName(listenerType, listenerMethodName)));
+
         this.addListenerMethod = findMethodByPrefix(sourceClass, "add", "",
                 listenerType);
         this.removeListenerMethod = findMethodByPrefix(sourceClass, "remove",
                 "", listenerType);
-        
-        if(addListenerMethod == null && removeListenerMethod == null) {
+
+        if (addListenerMethod == null && removeListenerMethod == null) {
             throw new IntrospectionException(
                     "Add and remove methods are not available");
         }
-        
+
         this.getListenerMethod = findMethodByPrefix(sourceClass, "get", "s",
                 listenerType);
 
         this.unicast = isUnicastByDefault(addListenerMethod);
 
-   }
-    
+    }
+
     /**
      * @com.intel.drl.spec_ref
      */
     public EventSetDescriptor(Class<?> sourceClass, String eventSetName,
-        Class<?> listenerType, String[] listenerMethodNames,
-        String addListenerMethodName, String removeListenerMethodName
-    ) throws IntrospectionException {
+            Class<?> listenerType, String[] listenerMethodNames,
+            String addListenerMethodName, String removeListenerMethodName)
+            throws IntrospectionException {
         super();
-        
+
         setName(eventSetName);
         setDisplayName(eventSetName);
-        this.eventSetName = eventSetName;
+        
+        //XXX: never read
+        //this.eventSetName = eventSetName;
+
         this.listenerType = listenerType;
 
-        if(listenerMethodNames != null) {
-            for(int i = 0; i < listenerMethodNames.length; ++i) {
+        if (listenerMethodNames != null) {
+            for (int i = 0; i < listenerMethodNames.length; ++i) {
                 try {
                     listenerMethodDescriptors.add(new MethodDescriptor(
-                            findMethodByName(listenerType, listenerMethodNames[i])));
+                            findMethodByName(listenerType,
+                                    listenerMethodNames[i])));
                 } catch (IntrospectionException ie) {
                     listenerMethodDescriptors.clear();
                     throw ie;
@@ -111,72 +116,71 @@
         this.removeListenerMethod = findMethodByName(listenerType,
                 removeListenerMethodName);
         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,
+    public EventSetDescriptor(Class<?> sourceClass, String eventSetName,
+            Class<?> listenerType, String[] listenerMethodNames,
+            String addListenerMethodName, String removeListenerMethodName,
             String getListenerMethodName) throws IntrospectionException {
         super();
-        
+
         setName(eventSetName);
         setDisplayName(eventSetName);
-        this.eventSetName = eventSetName;
+        
+        //XXX: never read
+        //this.eventSetName = eventSetName;
+
         this.listenerType = listenerType;
 
-        if(listenerMethodNames != null) {
-            for(int i = 0; i < listenerMethodNames.length; ++i) {
+        if (listenerMethodNames != null) {
+            for (int i = 0; i < listenerMethodNames.length; ++i) {
                 try {
-                    listenerMethodDescriptors.add(
-                        new MethodDescriptor(findMethodByName(listenerType,
-                                listenerMethodNames[i])));
+                    listenerMethodDescriptors.add(new MethodDescriptor(
+                            findMethodByName(listenerType,
+                                    listenerMethodNames[i])));
                 } catch (IntrospectionException ie) {
                     listenerMethodDescriptors.clear();
                     throw ie;
                 }
             }
         }
-    
+
         this.addListenerMethod = findMethodByName(listenerType,
                 addListenerMethodName);
         this.removeListenerMethod = findMethodByName(listenerType,
                 removeListenerMethodName);
         this.getListenerMethod = findMethodByName(listenerType,
                 getListenerMethodName);
-        
+
         this.unicast = isUnicastByDefault(addListenerMethod);
-        
+
     }
-    
+
     /**
      * @com.intel.drl.spec_ref
      */
-    public EventSetDescriptor(
-            String eventSetName,
-            Class<?> listenerType,
-            Method[] listenerMethods,
-            Method addListenerMethod,
+    public EventSetDescriptor(String eventSetName, Class<?> listenerType,
+            Method[] listenerMethods, Method addListenerMethod,
             Method removeListenerMethod) throws IntrospectionException {
         super();
-        
+
         setName(eventSetName);
         setDisplayName(eventSetName);
-        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])) {
+
+        if (listenerMethods != null) {
+            for (int i = 0; i < listenerMethods.length; ++i) {
+                if (checkMethod(listenerType, listenerMethods[i])) {
                     this.listenerMethodDescriptors.add(new MethodDescriptor(
                             listenerMethods[i]));
                 }
@@ -188,29 +192,32 @@
         this.removeListenerMethod = checkRegistrationMethod(listenerType,
                 removeListenerMethod);
         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
-    ) throws IntrospectionException {
+    public EventSetDescriptor(String eventSetName, Class<?> listenerType,
+            Method[] listenerMethods, Method addListenerMethod,
+            Method removeListenerMethod, Method getListenerMethod)
+            throws IntrospectionException {
+
+        super();
 
-           super();
-           
         setName(eventSetName);
         setDisplayName(eventSetName);
-        this.eventSetName = eventSetName;
-        this.listenerType = listenerType;
         
-        if(listenerMethods != null) {
-            for(int i = 0; i < listenerMethods.length; ++i) {
-                if(checkMethod(listenerType, listenerMethods[i])) {
+        //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])) {
                     this.listenerMethodDescriptors.add(new MethodDescriptor(
                             listenerMethods[i]));
                 }
@@ -223,41 +230,44 @@
                 removeListenerMethod);
         this.getListenerMethod = checkGetListenerMethod(listenerType,
                 getListenerMethod);
-        
+
         this.unicast = isUnicastByDefault(addListenerMethod);
-        
-   }
+
+    }
 
     /**
      * @com.intel.drl.spec_ref
      */
     public EventSetDescriptor(String eventSetName, Class<?> listenerType,
-        MethodDescriptor[] listenerMethodDescriptors,
-        Method addListenerMethod, Method removeListenerMethod
-    ) throws IntrospectionException {
+            MethodDescriptor[] listenerMethodDescriptors,
+            Method addListenerMethod, Method removeListenerMethod)
+            throws IntrospectionException {
         super();
-        
+
         setName(eventSetName);
         setDisplayName(eventSetName);
-        this.eventSetName = eventSetName;
-        this.listenerType = listenerType;
         
+        //XXX: never read
+        //this.eventSetName = eventSetName;
+
+        this.listenerType = listenerType;
+
         for (int i = 0; i < listenerMethodDescriptors.length; ++i) {
             Method listenerMethod = listenerMethodDescriptors[i].getMethod();
-            if(checkMethod(listenerType, listenerMethod)) {
-                this.listenerMethodDescriptors.add(
-                        listenerMethodDescriptors[i]);
+
+            if (checkMethod(listenerType, listenerMethod)) {
+                this.listenerMethodDescriptors
+                        .add(listenerMethodDescriptors[i]);
             }
         }
-        
+
         this.addListenerMethod = checkRegistrationMethod(listenerType,
                 addListenerMethod);
         this.removeListenerMethod = checkRegistrationMethod(listenerType,
                 removeListenerMethod);
         this.getListenerMethod = null;
-        
+
         this.unicast = isUnicastByDefault(addListenerMethod);
-        
     }
 
     /**
@@ -267,23 +277,26 @@
         Method[] result = new Method[listenerMethodDescriptors.size()];
         Iterator<MethodDescriptor> i = listenerMethodDescriptors.iterator();
         int idx = 0;
-        while(i.hasNext()) {
+
+        while (i.hasNext()) {
             MethodDescriptor md = i.next();
+
             result[idx] = md.getMethod();
             idx++;
         }
         return result;
     }
-    
+
     /**
      * @com.intel.drl.spec_ref
      */
     public MethodDescriptor[] getListenerMethodDescriptors() {
-        MethodDescriptor[] result =
-                new MethodDescriptor[listenerMethodDescriptors.size()];
+        MethodDescriptor[] result = new MethodDescriptor[listenerMethodDescriptors
+                .size()];
         Iterator<MethodDescriptor> i = listenerMethodDescriptors.iterator();
         int idx = 0;
-        while(i.hasNext()) {
+
+        while (i.hasNext()) {
             result[idx] = i.next();
             idx++;
         }
@@ -345,19 +358,20 @@
     public boolean isInDefaultEventSet() {
         return inDefaultEventSet;
     }
-    
+
     private Class<?> getEventType(Class<?> listenerType)
             throws ClassNotFoundException {
         String listenerTypeName = listenerType.getName();
         int idx = listenerTypeName.lastIndexOf("Listener");
         String eventTypeName = listenerTypeName.substring(0, idx) + "Event";
-        return Class.forName(eventTypeName, true,
-                listenerType.getClassLoader());
+
+        return Class
+                .forName(eventTypeName, true, listenerType.getClassLoader());
     }
 
     private boolean checkMethod(Class<?> listenerType, Method listenerMethod)
             throws IntrospectionException {
-        if(listenerMethod != null
+        if (listenerMethod != null
                 && !listenerMethod.getDeclaringClass().isAssignableFrom(
                         listenerType)) {
             throw new IntrospectionException("No method \""
@@ -367,7 +381,7 @@
             return true;
         }
     }
-    
+
     private Method findMethodByName(Class<?> listenerType,
             String listenerMethodName) throws IntrospectionException {
         try {
@@ -378,22 +392,22 @@
                     + listenerMethodName + "\" for " + listenerType.getName()
                     + " found.");
         } catch (ClassNotFoundException cnfe) {
-            throw new IntrospectionException(
-                "Cannot acquire event type from " + listenerType.getName()
-                + " listener.");
+            throw new IntrospectionException("Cannot acquire event type from "
+                    + listenerType.getName() + " listener.");
         }
     }
-    
-    private Method findMethodByPrefix(
-            Class<?> sourceClass,
-            String prefix,
-            String postfix,
-            Class<?> listenerType) {
-        String fullName = listenerType.getName(); // com.drl.beans.SmthListener
+
+    private Method findMethodByPrefix(Class<?> sourceClass, String prefix,
+            String postfix, Class<?> listenerType) {
+
+        // com.drl.beans.SmthListener
+        String fullName = listenerType.getName();
         int idx = fullName.lastIndexOf(".");
-        String methodName = prefix + fullName.substring(idx + 1) + postfix; // prefix(e.g., add) + SmthListener
+        // prefix(e.g., add) + SmthListener
+        String methodName = prefix + fullName.substring(idx + 1) + postfix;
+
         try {
-            if(prefix.equals("get")) {
+            if (prefix.equals("get")) {
                 return sourceClass.getMethod(methodName, new Class[] {});
             } else {
                 return sourceClass.getMethod(methodName,
@@ -402,69 +416,70 @@
         } catch (NoSuchMethodException nsme) {
             return null;
         }
-            
+
     }
-    
+
     private static boolean isUnicastByDefault(Method addMethod) {
-        if(addMethod != null) {
+        if (addMethod != null) {
             Class[] exceptionTypes = addMethod.getExceptionTypes();
-            for(int i = 0; i < exceptionTypes.length; ++i) {
-                if(exceptionTypes[i].equals(TooManyListenersException.class)) {
+
+            for (int i = 0; i < exceptionTypes.length; ++i) {
+                if (exceptionTypes[i].equals(TooManyListenersException.class)) {
                     return true;
                 }
             }
         }
         return false;
     }
-    
-    private static Method checkRegistrationMethod(
-            Class<?> listenerType,
+
+    private static Method checkRegistrationMethod(Class<?> listenerType,
             Method registrationMethod) throws IntrospectionException {
-        if(registrationMethod == null) {
+        if (registrationMethod == null) {
             return null;
         } else {
             Class<?> returnType = registrationMethod.getReturnType();
-            
-            if(returnType != void.class) {
+            Class[] parameterTypes;
+
+            if (returnType != void.class) {
                 throw new IntrospectionException(registrationMethod.getName()
                         + " does not return <void>");
             }
-            
-            Class[] parameterTypes = registrationMethod.getParameterTypes();
-            if(parameterTypes == null || parameterTypes.length != 1) {
+
+            parameterTypes = registrationMethod.getParameterTypes();
+            if (parameterTypes == null || parameterTypes.length != 1) {
                 throw new IntrospectionException(registrationMethod.getName()
                         + " should have a single input parameter");
-            } else if(parameterTypes[0] != listenerType){
+            } else if (parameterTypes[0] != listenerType) {
                 throw new IntrospectionException(
                         "Single parameter does not match to "
-                        + listenerType.getName() + " class");
+                                + listenerType.getName() + " class");
             } else {
                 return registrationMethod;
             }
         }
     }
-    
-    private static Method checkGetListenerMethod(
-            Class<?> listenerType,
+
+    private static Method checkGetListenerMethod(Class<?> listenerType,
             Method getListenerMethod) throws IntrospectionException {
-        if(getListenerMethod == null) {
+        if (getListenerMethod == null) {
             return null;
         } else {
             Class[] parameterTypes = getListenerMethod.getParameterTypes();
-            
-            if(parameterTypes.length != 0) {
+            Class<?> returnType;
+
+            if (parameterTypes.length != 0) {
                 throw new IntrospectionException(
                         "No input params are allowed for getListenerMethod");
             }
-            
-            Class<?> returnType = getListenerMethod.getReturnType();
-            if(returnType.isArray()
+
+            returnType = getListenerMethod.getReturnType();
+            if (returnType.isArray()
                     && returnType.getComponentType() == listenerType) {
                 return getListenerMethod;
             } else {
                 throw new IntrospectionException(
                         "Return type of getListenerMethod is not an array "
-                        + "of listeners");
+                                + "of listeners");
             }
         }
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/org/apache/harmony/beans/ObjectNode.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/org/apache/harmony/beans/ObjectNode.java?rev=420762&r1=420761&r2=420762&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/org/apache/harmony/beans/ObjectNode.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/org/apache/harmony/beans/ObjectNode.java Tue Jul 11 01:38:04 2006
@@ -1,147 +1,147 @@
-/*
- *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.1.2.1 $
- */
-package org.apache.harmony.beans;
-
-import java.beans.Expression;
-import java.beans.Statement;
-import java.util.Iterator;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.Vector;
-
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.1.2.1 $
- */
-
-public class ObjectNode {
-
-    private Expression initializer;
-    private Object objectValue = null;
-    private HashMap<Object, ObjectNode> nodes;
-
-    private LinkedHashSet<Statement> statements =
-            new LinkedHashSet<Statement>();
-    private Vector<Expression> expressions = new Vector<Expression>();
-    private Vector<Expression> referencedExpressions = new Vector<Expression>();
-    
-    private int referencesNumber = 0;
-    private String id = null;
-
-    public ObjectNode(Expression initializer) {
-        this.initializer = initializer;
-        this.nodes = null;
-    }
-    
-    public ObjectNode(Expression initializer,
-            HashMap<Object, ObjectNode> nodes)
-    {
-        this.initializer = initializer;
-        this.nodes = nodes;
-    }
-    
-    public Expression getInitializer() {
-        return initializer;
-    }
-    
-    public Object getObjectValue() throws Exception {
-        if(objectValue != null) {
-            return objectValue;
-        }
-        
-        if(nodes != null) {
-            Object[] oldArgs = initializer.getArguments();            
-            Object[] newArgs = new Object[oldArgs.length];
-            
-            for(int i = 0; i < oldArgs.length; ++i) {
-                if(oldArgs[i] != null) {
-                    ObjectNode node = nodes.get(oldArgs[i]);
-
-                    newArgs[i] = node.getObjectValue();
-                } else {
-                    newArgs[i] = null;
-                }
-            }
-            
-            objectValue = (new Expression(initializer.getTarget(),
-                    initializer.getMethodName(), newArgs)).getValue();
-        } else {
-            objectValue = initializer.getValue();
-        }
-        
-        return objectValue; 
-    }
-    
-    public Class getObjectType() throws Exception {
-        Object value = getObjectValue();
-
-        return (value != null) ? value.getClass() : null;
-    }
-    
-    public Object[] getObjectArguments() {
-        return initializer.getArguments();
-        //return (nodes == null) ? new Object[0] : initializer.getArguments();
-    }
-    
-    public int getReferencesNumber() {
-        return referencesNumber;
-    }
-    
-    public int getReferencedExpressionsNumber() {
-        return referencedExpressions.size();
-    }
-    
-    public void addReference() {
-        referencesNumber++;
-    }
-    
-    public void addReferencedExpression(Expression expr) {
-        referencedExpressions.add(expr);
-    }
-    
-    public String getId() {
-        return id;
-    }
-    
-    public void setId(String id) {
-        this.id = id;
-    }
-    
-    public void addExpression(Expression expression) {
-        expressions.add(expression);
-    }
-
-    public void addStatement(Statement statement) {
-        statements.add(statement);
-    }
-    
-    public Iterator<Expression> expressions() {
-        return expressions.iterator();
-    }
-    
-    public Iterator<Expression> referencedExpressions() {
-        return referencedExpressions.iterator();
-    }
-    
-    public Iterator<Statement> statements() {
-        return statements.iterator();
-    }
-}
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.1.2.1 $
+ */
+package org.apache.harmony.beans;
+
+import java.beans.Expression;
+import java.beans.Statement;
+import java.util.Iterator;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.Vector;
+
+/**
+ * @author Maxim V. Berkultsev
+ * @version $Revision: 1.1.2.1 $
+ */
+
+public class ObjectNode {
+
+    private Expression initializer;
+    private Object objectValue = null;
+    private HashMap<Object, ObjectNode> nodes;
+
+    private LinkedHashSet<Statement> statements =
+            new LinkedHashSet<Statement>();
+    private Vector<Expression> expressions = new Vector<Expression>();
+    private Vector<Expression> referencedExpressions = new Vector<Expression>();
+    
+    private int referencesNumber = 0;
+    private String id = null;
+
+    public ObjectNode(Expression initializer) {
+        this.initializer = initializer;
+        this.nodes = null;
+    }
+    
+    public ObjectNode(Expression initializer,
+            HashMap<Object, ObjectNode> nodes)
+    {
+        this.initializer = initializer;
+        this.nodes = nodes;
+    }
+    
+    public Expression getInitializer() {
+        return initializer;
+    }
+    
+    public Object getObjectValue() throws Exception {
+        if(objectValue != null) {
+            return objectValue;
+        }
+        
+        if(nodes != null) {
+            Object[] oldArgs = initializer.getArguments();            
+            Object[] newArgs = new Object[oldArgs.length];
+            
+            for(int i = 0; i < oldArgs.length; ++i) {
+                if(oldArgs[i] != null) {
+                    ObjectNode node = nodes.get(oldArgs[i]);
+
+                    newArgs[i] = node.getObjectValue();
+                } else {
+                    newArgs[i] = null;
+                }
+            }
+            
+            objectValue = (new Expression(initializer.getTarget(),
+                    initializer.getMethodName(), newArgs)).getValue();
+        } else {
+            objectValue = initializer.getValue();
+        }
+        
+        return objectValue; 
+    }
+    
+    public Class getObjectType() throws Exception {
+        Object value = getObjectValue();
+
+        return (value != null) ? value.getClass() : null;
+    }
+    
+    public Object[] getObjectArguments() {
+        return initializer.getArguments();
+        //return (nodes == null) ? new Object[0] : initializer.getArguments();
+    }
+    
+    public int getReferencesNumber() {
+        return referencesNumber;
+    }
+    
+    public int getReferencedExpressionsNumber() {
+        return referencedExpressions.size();
+    }
+    
+    public void addReference() {
+        referencesNumber++;
+    }
+    
+    public void addReferencedExpression(Expression expr) {
+        referencedExpressions.add(expr);
+    }
+    
+    public String getId() {
+        return id;
+    }
+    
+    public void setId(String id) {
+        this.id = id;
+    }
+    
+    public void addExpression(Expression expression) {
+        expressions.add(expression);
+    }
+
+    public void addStatement(Statement statement) {
+        statements.add(statement);
+    }
+    
+    public Iterator<Expression> expressions() {
+        return expressions.iterator();
+    }
+    
+    public Iterator<Expression> referencedExpressions() {
+        return referencedExpressions.iterator();
+    }
+    
+    public Iterator<Statement> statements() {
+        return statements.iterator();
+    }
+}



Mime
View raw message