You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@click.apache.org by bc...@apache.org on 2010/06/21 11:41:56 UTC

svn commit: r956517 - in /click/trunk/click/framework/src/org/apache/click: ActionEventDispatcher.java CallbackDispatcher.java util/RequestTypeConverter.java

Author: bckfnn
Date: Mon Jun 21 09:41:55 2010
New Revision: 956517

URL: http://svn.apache.org/viewvc?rev=956517&view=rev
Log:
generics. CLK-696

Modified:
    click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java
    click/trunk/click/framework/src/org/apache/click/CallbackDispatcher.java
    click/trunk/click/framework/src/org/apache/click/util/RequestTypeConverter.java

Modified: click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java?rev=956517&r1=956516&r2=956517&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java (original)
+++ click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java Mon Jun 21 09:41:55 2010
@@ -201,18 +201,14 @@ public class ActionEventDispatcher {
      *
      * @return true if the page should continue processing or false otherwise
      */
-    protected boolean fireActionEvents(Context context, List eventSourceList,
-        List eventListenerList) {
+    protected boolean fireActionEvents(Context context, 
+        List<Control> eventSourceList, List<ActionListener> eventListenerList) {
 
         boolean continueProcessing = true;
 
         for (int i = 0, size = eventSourceList.size(); i < size; i++) {
-            Control source = (Control) eventSourceList.get(0);
-            ActionListener listener = (ActionListener) eventListenerList.get(0);
-
-            // Pop the first entry in the list
-            eventSourceList.remove(0);
-            eventListenerList.remove(0);
+            Control source = eventSourceList.remove(0);
+            ActionListener listener = eventListenerList.remove(0);
 
             if (!fireActionEvent(context, source, listener)) {
                 continueProcessing = false;

Modified: click/trunk/click/framework/src/org/apache/click/CallbackDispatcher.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/CallbackDispatcher.java?rev=956517&r1=956516&r2=956517&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/CallbackDispatcher.java (original)
+++ click/trunk/click/framework/src/org/apache/click/CallbackDispatcher.java Mon Jun 21 09:41:55 2010
@@ -36,7 +36,8 @@ public class CallbackDispatcher {
     // -------------------------------------------------------------- Constants
 
     /** The thread local dispatcher holder. */
-    private static final ThreadLocal THREAD_LOCAL_DISPATCHER = new ThreadLocal();
+    private static final ThreadLocal<DispatcherStack> THREAD_LOCAL_DISPATCHER = 
+                    new ThreadLocal<DispatcherStack>();
 
     // -------------------------------------------------------------- Variables
 
@@ -236,7 +237,7 @@ public class CallbackDispatcher {
     }
 
     static DispatcherStack getDispatcherStack() {
-        DispatcherStack dispatcherStack = (DispatcherStack) THREAD_LOCAL_DISPATCHER.get();
+        DispatcherStack dispatcherStack = THREAD_LOCAL_DISPATCHER.get();
 
         if (dispatcherStack == null) {
             dispatcherStack = new DispatcherStack(2);
@@ -249,7 +250,7 @@ public class CallbackDispatcher {
     /**
      * Provides an unsynchronized Stack.
      */
-    static class DispatcherStack extends ArrayList {
+    static class DispatcherStack extends ArrayList<CallbackDispatcher> {
 
         /** Serialization version indicator. */
         private static final long serialVersionUID = 1L;
@@ -302,7 +303,7 @@ public class CallbackDispatcher {
                 throw new RuntimeException(msg);
             }
 
-            return (CallbackDispatcher) get(length - 1);
+            return get(length - 1);
         }
     }
 

Modified: click/trunk/click/framework/src/org/apache/click/util/RequestTypeConverter.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/util/RequestTypeConverter.java?rev=956517&r1=956516&r2=956517&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/util/RequestTypeConverter.java (original)
+++ click/trunk/click/framework/src/org/apache/click/util/RequestTypeConverter.java Mon Jun 21 09:41:55 2010
@@ -58,6 +58,7 @@ public class RequestTypeConverter implem
      * @return Converted value of type toType or TypeConverter.NoConversionPossible
      *  to indicate that the conversion was not possible.
      */
+    @SuppressWarnings("unchecked")
     public Object convertValue(Map context, Object target, Member member,
             String propertyName, Object value, Class toType) {
 
@@ -73,14 +74,14 @@ public class RequestTypeConverter implem
      * @param toType the target class type to convert the value to
      * @return a converted value into the specified type
      */
-    protected Object convertValue(Object value, Class toType) {
+    protected Object convertValue(Object value, Class<?> toType) {
         Object result = null;
 
         if (value != null) {
 
             // If array -> array then convert components of array individually
             if (value.getClass().isArray() && toType.isArray()) {
-                Class componentType = toType.getComponentType();
+                Class<?> componentType = toType.getComponentType();
 
                 result =
                     Array.newInstance(componentType, Array.getLength(value));