You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mb...@apache.org on 2007/02/25 14:03:40 UTC

svn commit: r511498 - in /myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces: application/NavigationHandlerImpl.java application/TreeStructureManager.java application/jsp/JspStateManagerImpl.java el/ELParserHelper.java

Author: mbr
Date: Sun Feb 25 05:03:39 2007
New Revision: 511498

URL: http://svn.apache.org/viewvc?view=rev&rev=511498
Log:
generic types

Modified:
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/jsp/JspStateManagerImpl.java
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/el/ELParserHelper.java

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java?view=diff&rev=511498&r1=511497&r2=511498
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java Sun Feb 25 05:03:39 2007
@@ -52,8 +52,8 @@
 
     private static final String ASTERISK = "*";
 
-    private Map _navigationCases = null;
-    private List _wildcardKeys = new ArrayList();
+    private Map<String, List> _navigationCases = null;
+    private List<String> _wildcardKeys = new ArrayList<String>();
 
     public NavigationHandlerImpl()
     {
@@ -122,10 +122,10 @@
     public NavigationCase getNavigationCase(FacesContext facesContext, String fromAction, String outcome)
     {
         String viewId = facesContext.getViewRoot().getViewId();
-        Map casesMap = getNavigationCases(facesContext);
+        Map<String, List> casesMap = getNavigationCases(facesContext);
         NavigationCase navigationCase = null;
 
-        List casesList = (List)casesMap.get(viewId);
+        List casesList = casesMap.get(viewId);
         if (casesList != null)
         {
             // Exact match?
@@ -135,16 +135,16 @@
         if (navigationCase == null)
         {
             // Wildcard match?
-            List keys = getSortedWildcardKeys();
+            List<String> keys = getSortedWildcardKeys();
             for (int i = 0, size = keys.size(); i < size; i++)
             {
-                String fromViewId = (String)keys.get(i);
+                String fromViewId = keys.get(i);
                 if (fromViewId.length() > 2)
                 {
                     String prefix = fromViewId.substring(0, fromViewId.length() - 1);
                     if (viewId != null && viewId.startsWith(prefix))
                     {
-                        casesList = (List)casesMap.get(fromViewId);
+                        casesList = casesMap.get(fromViewId);
                         if (casesList != null)
                         {
                             navigationCase = calcMatchingNavigationCase(casesList, fromAction, outcome);
@@ -154,7 +154,7 @@
                 }
                 else
                 {
-                    casesList = (List)casesMap.get(fromViewId);
+                    casesList = casesMap.get(fromViewId);
                     if (casesList != null)
                     {
                         navigationCase = calcMatchingNavigationCase(casesList, fromAction, outcome);
@@ -202,12 +202,12 @@
         return null;
     }
 
-    private List getSortedWildcardKeys()
+    private List<String> getSortedWildcardKeys()
     {
         return _wildcardKeys;
     }
 
-    private Map getNavigationCases(FacesContext facesContext)
+    private Map<String, List> getNavigationCases(FacesContext facesContext)
     {
         ExternalContext externalContext = facesContext.getExternalContext();
         RuntimeConfig runtimeConfig = RuntimeConfig.getCurrentInstance(externalContext);
@@ -220,8 +220,8 @@
                 {
                     Collection rules = runtimeConfig.getNavigationRules();
                     int rulesSize = rules.size();
-                    Map cases = new HashMap(HashMapUtils.calcCapacity(rulesSize));
-                    List wildcardKeys = new ArrayList();
+                    Map<String, List> cases = new HashMap<String, List>(HashMapUtils.calcCapacity(rulesSize));
+                    List<String> wildcardKeys = new ArrayList<String>();
 
                     for (Iterator iterator = rules.iterator(); iterator.hasNext();)
                     {
@@ -238,7 +238,7 @@
                             fromViewId = fromViewId.trim();
                         }
 
-                        List list = (List) cases.get(fromViewId);
+                        List list = cases.get(fromViewId);
                         if (list == null)
                         {
                             list = new ArrayList(rule.getNavigationCases());

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java?view=diff&rev=511498&r1=511497&r2=511498
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java Sun Feb 25 05:03:39 2007
@@ -54,7 +54,7 @@
         if (component.getChildCount() > 0)
         {
             List childList = component.getChildren();
-            List structChildList = new ArrayList();
+            List<TreeStructComponent> structChildList = new ArrayList<TreeStructComponent>();
             for (int i = 0, len = childList.size(); i < len; i++)
             {
                 UIComponent child = (UIComponent)childList.get(i);
@@ -64,15 +64,15 @@
                     structChildList.add(structChild);
                 }
             }
-            TreeStructComponent[] childArray = (TreeStructComponent[])structChildList.toArray(new TreeStructComponent[structChildList.size()]);
+            TreeStructComponent[] childArray = structChildList.toArray(new TreeStructComponent[structChildList.size()]);
             structComp.setChildren(childArray);
         }
 
         //facets
-        Map facetMap = component.getFacets();
+        Map<String, UIComponent> facetMap = component.getFacets();
         if (!facetMap.isEmpty())
         {
-            List structFacetList = new ArrayList();
+            List<Object[]> structFacetList = new ArrayList<Object[]>();
             for (Iterator it = facetMap.entrySet().iterator(); it.hasNext(); )
             {
                 Map.Entry entry = (Map.Entry)it.next();
@@ -115,7 +115,7 @@
         TreeStructComponent[] childArray = treeStructComp.getChildren();
         if (childArray != null)
         {
-            List childList = component.getChildren();
+            List<UIComponent> childList = component.getChildren();
             for (int i = 0, len = childArray.length; i < len; i++)
             {
                 UIComponent child = internalRestoreTreeStructure(childArray[i]);
@@ -127,7 +127,7 @@
         Object[] facetArray = treeStructComp.getFacets();
         if (facetArray != null)
         {
-            Map facetMap = component.getFacets();
+            Map<String, UIComponent> facetMap = component.getFacets();
             for (int i = 0, len = facetArray.length; i < len; i++)
             {
                 Object[] tuple = (Object[])facetArray[i];

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/jsp/JspStateManagerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/jsp/JspStateManagerImpl.java?view=diff&rev=511498&r1=511497&r2=511498
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/jsp/JspStateManagerImpl.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/jsp/JspStateManagerImpl.java Sun Feb 25 05:03:39 2007
@@ -341,7 +341,7 @@
     {
         if (log.isTraceEnabled()) log.trace("Entering saveSerializedView");
 
-        checkForDuplicateIds(facesContext, facesContext.getViewRoot(), new HashSet());
+        checkForDuplicateIds(facesContext, facesContext.getViewRoot(), new HashSet<String>());
 
         if (log.isTraceEnabled()) log.trace("Processing saveSerializedView - Checked for duplicate Ids");
 
@@ -383,7 +383,7 @@
 
     private static void checkForDuplicateIds(FacesContext context,
                                              UIComponent component,
-                                             Set ids)
+                                             Set<String> ids)
     {
         String id = component.getId();
         if (id != null && !ids.add(id))
@@ -399,7 +399,7 @@
             UIComponent kid = (UIComponent) it.next();
             if (namingContainer)
             {
-                checkForDuplicateIds(context, kid, new HashSet());
+                checkForDuplicateIds(context, kid, new HashSet<String>());
             }
             else
             {
@@ -529,7 +529,7 @@
     protected void saveSerializedViewInServletSession(FacesContext context,
                                                       Object serializedView)
     {
-        Map sessionMap = context.getExternalContext().getSessionMap();
+        Map<String, Object> sessionMap = context.getExternalContext().getSessionMap();
         SerializedViewCollection viewCollection = (SerializedViewCollection) sessionMap
                 .get(SERIALIZED_VIEW_SESSION_ATTR);
         if (viewCollection == null)
@@ -545,7 +545,7 @@
     protected Object getSerializedViewFromServletSession(FacesContext context, String viewId)
     {
         ExternalContext externalContext = context.getExternalContext();
-        Map requestMap = externalContext.getRequestMap();
+        Map<String, Object> requestMap = externalContext.getRequestMap();
         Object serializedView = null;
         if (requestMap.containsKey(RESTORED_SERIALIZED_VIEW_REQUEST_ATTR))
         {
@@ -592,7 +592,7 @@
         synchronized(sessionObj) // synchronized to increase sequence if multiple requests 
                                  // are handled at the same time for the session
         {
-            Map map = externalContext.getSessionMap();
+            Map<String, Object> map = externalContext.getSessionMap();
             Integer sequence = (Integer) map.get(RendererUtils.SEQUENCE_PARAM);
             if(sequence == null || sequence.intValue() == Integer.MAX_VALUE)
             {
@@ -761,12 +761,12 @@
     {
         private static final long serialVersionUID = -3734849062185115847L;
 
-        private final List _keys = new ArrayList(DEFAULT_NUMBER_OF_VIEWS_IN_SESSION);
-        private final Map _serializedViews = new HashMap();
+        private final List<Object> _keys = new ArrayList<Object>(DEFAULT_NUMBER_OF_VIEWS_IN_SESSION);
+        private final Map<Object, Object> _serializedViews = new HashMap<Object, Object>();
 
         // old views will be hold as soft references which will be removed by 
         // the garbage collector if free memory is low
-        private transient Map _oldSerializedViews = null;
+        private transient Map<Object, Object> _oldSerializedViews = null;
 
         public synchronized void add(FacesContext context, Object state)
         {
@@ -825,7 +825,7 @@
         /**
          * @return old serialized views map
          */
-        protected Map getOldSerializedViewsMap()
+        protected Map<Object, Object> getOldSerializedViewsMap()
         {
             if (_oldSerializedViews == null)
             {

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/el/ELParserHelper.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/el/ELParserHelper.java?view=diff&rev=511498&r1=511497&r2=511498
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/el/ELParserHelper.java (original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/el/ELParserHelper.java Sun Feb 25 05:03:39 2007
@@ -361,10 +361,10 @@
         Application application = FacesContext.getCurrentInstance()
             .getApplication();
 
-        List suffixes = complexValue.getSuffixes();
+        List<ArraySuffix> suffixes = complexValue.getSuffixes();
         for (int i = 0, len = suffixes.size(); i < len; i++)
         {
-            ValueSuffix suffix = (ValueSuffix) suffixes.get(i);
+            ValueSuffix suffix = suffixes.get(i);
             if (suffix instanceof PropertySuffix)
             {
                 if (suffix instanceof MyPropertySuffix)