myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject [myfaces] branch master updated: cosmetics
Date Mon, 10 Dec 2018 19:02:13 GMT
This is an automated email from the ASF dual-hosted git repository.

tandraschko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces.git


The following commit(s) were added to refs/heads/master by this push:
     new 363faf5  cosmetics
363faf5 is described below

commit 363faf56d5c23cfae24268e73c53d5137ad60d33
Author: Thomas Andraschko <tandraschko@apache.org>
AuthorDate: Mon Dec 10 20:02:17 2018 +0100

    cosmetics
---
 .../application/DefaultViewHandlerSupport.java     |  4 ++--
 .../apache/myfaces/context/RequestViewContext.java | 10 ++++----
 .../myfaces/context/RequestViewMetadata.java       | 19 ++++++++-------
 .../myfaces/lifecycle/CheckedViewIdsCache.java     |  9 ++++++--
 .../lifecycle/DefaultRestoreViewSupport.java       |  4 ++--
 .../org/apache/myfaces/util/NavigationUtils.java   | 27 +++++++++++++---------
 6 files changed, 41 insertions(+), 32 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/application/DefaultViewHandlerSupport.java
b/impl/src/main/java/org/apache/myfaces/application/DefaultViewHandlerSupport.java
index e840f13..4b38ab1 100644
--- a/impl/src/main/java/org/apache/myfaces/application/DefaultViewHandlerSupport.java
+++ b/impl/src/main/java/org/apache/myfaces/application/DefaultViewHandlerSupport.java
@@ -571,7 +571,7 @@ public class DefaultViewHandlerSupport implements ViewHandlerSupport
             Boolean resourceExists = null;
             if (checkedViewIdsCache.isEnabled())
             {
-                resourceExists = checkedViewIdsCache.getCache().get(viewId);
+                resourceExists = checkedViewIdsCache.get(viewId);
             }
 
             if (resourceExists == null)
@@ -590,7 +590,7 @@ public class DefaultViewHandlerSupport implements ViewHandlerSupport
 
                 if (checkedViewIdsCache.isEnabled())
                 {
-                    checkedViewIdsCache.getCache().put(viewId, resourceExists);
+                    checkedViewIdsCache.put(viewId, resourceExists);
                 }
             }
 
diff --git a/impl/src/main/java/org/apache/myfaces/context/RequestViewContext.java b/impl/src/main/java/org/apache/myfaces/context/RequestViewContext.java
index 6b71685..2db3b70 100644
--- a/impl/src/main/java/org/apache/myfaces/context/RequestViewContext.java
+++ b/impl/src/main/java/org/apache/myfaces/context/RequestViewContext.java
@@ -87,7 +87,7 @@ public class RequestViewContext
         RequestViewContext rvc = null;        
         if (map == null)
         {
-            map = new HashMap<UIViewRoot, RequestViewContext>();
+            map = new HashMap<>();
             rvc = new RequestViewContext();
             map.put(root, rvc);
             ctx.getAttributes().put(VIEW_CONTEXT_KEY, map);
@@ -132,7 +132,7 @@ public class RequestViewContext
                 = (Map<UIViewRoot, RequestViewContext>) ctx.getAttributes().get(VIEW_CONTEXT_KEY);
         if (map == null)
         {
-            map = new HashMap<UIViewRoot, RequestViewContext>();
+            map = new HashMap<>();
             rvc = new RequestViewContext();
             map.put(root, rvc);
             ctx.getAttributes().put(VIEW_CONTEXT_KEY, map);
@@ -176,17 +176,17 @@ public class RequestViewContext
     {
         if (renderTargetMap == null)
         {
-            renderTargetMap = new HashMap<String, Boolean>(8);
+            renderTargetMap = new HashMap<>(8);
         }
         renderTargetMap.put(target, value);
         if (renderTargetMapComponents == null)
         {
-            renderTargetMapComponents = new HashMap<String, List<UIComponent>>(8);
+            renderTargetMapComponents = new HashMap<>(8);
         }
         List<UIComponent> componentList = renderTargetMapComponents.get(target);
         if (componentList == null)
         {
-            componentList = new ArrayList<UIComponent>(8);
+            componentList = new ArrayList<>(8);
             renderTargetMapComponents.put(target, componentList);
         }
         if (!componentList.contains(component))
diff --git a/impl/src/main/java/org/apache/myfaces/context/RequestViewMetadata.java b/impl/src/main/java/org/apache/myfaces/context/RequestViewMetadata.java
index 8af2230..c7c1204 100644
--- a/impl/src/main/java/org/apache/myfaces/context/RequestViewMetadata.java
+++ b/impl/src/main/java/org/apache/myfaces/context/RequestViewMetadata.java
@@ -59,18 +59,16 @@ public class RequestViewMetadata implements Serializable
     public RequestViewMetadata cloneInstance()
     {
         RequestViewMetadata rvm = new RequestViewMetadata();
-        rvm.initialProcessedClasses = new HashMap<Class<?>, Boolean>(
+        rvm.initialProcessedClasses = new HashMap<>(
                 this.initialProcessedClasses != null ? 
                     this.initialProcessedClasses : this.processedClasses);
         if (this.initialAddedResources != null)
         {
-            rvm.initialAddedResources = new HashMap<ResourceDependency, Boolean>(
-                    this.initialAddedResources);
+            rvm.initialAddedResources = new HashMap<>(this.initialAddedResources);
         }
         else if (this.addedResources != null)
         {
-            rvm.initialAddedResources = new HashMap<ResourceDependency, Boolean>(
-                    this.addedResources);
+            rvm.initialAddedResources = new HashMap<>(this.addedResources);
         }
         return rvm;
     }
@@ -95,7 +93,7 @@ public class RequestViewMetadata implements Serializable
     {
         if (addedResources == null)
         {
-            addedResources = new HashMap<ResourceDependency,Boolean>();
+            addedResources = new HashMap<>();
         }
         addedResources.put(dependency, true);
     }
@@ -123,8 +121,8 @@ public class RequestViewMetadata implements Serializable
         {
             return Collections.emptyMap();
         }
-        Map<String, List<ResourceDependency>> map = new HashMap<String, List<ResourceDependency>>();
-        //List<ResourceDependency> list = new ArrayList<ResourceDependency>();
+        
+        Map<String, List<ResourceDependency>> map = new HashMap<>();
         if (initialAddedResources != null)
         {
             for (ResourceDependency annotation : initialAddedResources.keySet())
@@ -142,7 +140,7 @@ public class RequestViewMetadata implements Serializable
                 List<ResourceDependency> list = map.get(target);
                 if (list == null)
                 {
-                    list = new ArrayList<ResourceDependency>();
+                    list = new ArrayList<>();
                     map.put(target, list);
                 }
                 list.add(annotation);
@@ -162,10 +160,11 @@ public class RequestViewMetadata implements Serializable
                 {
                     target = "head";
                 }
+
                 List<ResourceDependency> list = map.get(target);
                 if (list == null)
                 {
-                    list = new ArrayList<ResourceDependency>();
+                    list = new ArrayList<>();
                     map.put(target, list);
                 }
                 list.add(annotation);
diff --git a/impl/src/main/java/org/apache/myfaces/lifecycle/CheckedViewIdsCache.java b/impl/src/main/java/org/apache/myfaces/lifecycle/CheckedViewIdsCache.java
index 00e966d..b3ec36f 100644
--- a/impl/src/main/java/org/apache/myfaces/lifecycle/CheckedViewIdsCache.java
+++ b/impl/src/main/java/org/apache/myfaces/lifecycle/CheckedViewIdsCache.java
@@ -90,9 +90,14 @@ public class CheckedViewIdsCache
         return enabled;
     }
     
-    public ConcurrentLRUCache<String, Boolean> getCache()
+    public Boolean get(String viewId)
     {
-        return cache;
+        return cache.get(viewId);
+    }
+    
+    public Boolean put(String viewId, Boolean exists)
+    {
+        return cache.put(viewId, exists);
     }
     
     public static CheckedViewIdsCache getInstance(FacesContext facesContext)
diff --git a/impl/src/main/java/org/apache/myfaces/lifecycle/DefaultRestoreViewSupport.java
b/impl/src/main/java/org/apache/myfaces/lifecycle/DefaultRestoreViewSupport.java
index 88b119a..10cc20c 100644
--- a/impl/src/main/java/org/apache/myfaces/lifecycle/DefaultRestoreViewSupport.java
+++ b/impl/src/main/java/org/apache/myfaces/lifecycle/DefaultRestoreViewSupport.java
@@ -232,7 +232,7 @@ public class DefaultRestoreViewSupport implements RestoreViewSupport
             Boolean resourceExists = null;
             if (checkedViewIdsCache.isEnabled())
             {
-                resourceExists = checkedViewIdsCache.getCache().get(viewId);
+                resourceExists = checkedViewIdsCache.get(viewId);
             }
 
             if (resourceExists == null)
@@ -251,7 +251,7 @@ public class DefaultRestoreViewSupport implements RestoreViewSupport
 
                 if (checkedViewIdsCache.isEnabled())
                 {
-                    checkedViewIdsCache.getCache().put(viewId, resourceExists);
+                    checkedViewIdsCache.put(viewId, resourceExists);
                 }
             }
 
diff --git a/impl/src/main/java/org/apache/myfaces/util/NavigationUtils.java b/impl/src/main/java/org/apache/myfaces/util/NavigationUtils.java
index 69d6ac7..a0c260b 100644
--- a/impl/src/main/java/org/apache/myfaces/util/NavigationUtils.java
+++ b/impl/src/main/java/org/apache/myfaces/util/NavigationUtils.java
@@ -21,6 +21,7 @@ package org.apache.myfaces.util;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Set;
+import javax.faces.application.NavigationCase;
 import org.apache.myfaces.config.element.NavigationRule;
 
 /**
@@ -29,16 +30,15 @@ import org.apache.myfaces.config.element.NavigationRule;
  */
 public final class NavigationUtils
 {
-    public static Set<javax.faces.application.NavigationCase> convertNavigationCasesToAPI(NavigationRule
rule)
+    public static Set<NavigationCase> convertNavigationCasesToAPI(NavigationRule rule)
     {
         Collection<? extends org.apache.myfaces.config.element.NavigationCase> configCases
= 
                 rule.getNavigationCases();
-        Set<javax.faces.application.NavigationCase> apiCases = 
-                new HashSet<javax.faces.application.NavigationCase>(configCases.size());
+        Set<NavigationCase> apiCases = new HashSet<>(configCases.size());
         
-        for(org.apache.myfaces.config.element.NavigationCase configCase : configCases)
+        for (org.apache.myfaces.config.element.NavigationCase configCase : configCases)
         {   
-            if(configCase.getRedirect() != null)
+            if (configCase.getRedirect() != null)
             {
                 String includeViewParamsAttribute = configCase.getRedirect().getIncludeViewParams();
                 boolean includeViewParams = false; // default value is false
@@ -46,18 +46,23 @@ public final class NavigationUtils
                 {
                     includeViewParams = Boolean.valueOf(includeViewParamsAttribute);
                 }
-                apiCases.add(new javax.faces.application.NavigationCase(rule.getFromViewId(),
+                apiCases.add(new NavigationCase(rule.getFromViewId(),
                         configCase.getFromAction(),
-                                                configCase.getFromOutcome(),configCase.getIf(),
+                        configCase.getFromOutcome(),configCase.getIf(),
                         configCase.getToViewId(),
-                                                configCase.getRedirect().getViewParams(),true,includeViewParams));
+                        configCase.getRedirect().getViewParams()
+                        ,true,
+                        includeViewParams));
             }
             else
             {
-                apiCases.add(new javax.faces.application.NavigationCase(rule.getFromViewId(),
+                apiCases.add(new NavigationCase(rule.getFromViewId(),
                         configCase.getFromAction(),
-                                                configCase.getFromOutcome(),configCase.getIf(),
-                                                configCase.getToViewId(),null,false,false));
+                        configCase.getFromOutcome(),configCase.getIf(),
+                        configCase.getToViewId(),
+                        null,
+                        false,
+                        false));
             }
         }
         


Mime
View raw message