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: refactored; also set initial sizes of collections
Date Wed, 30 Jan 2019 22:37:46 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 939bbea  refactored; also set initial sizes of collections
939bbea is described below

commit 939bbea726e6bbde772da445c40ce716b1bbc206
Author: Thomas Andraschko <tandraschko@apache.org>
AuthorDate: Wed Jan 30 23:36:08 2019 +0100

    refactored; also set initial sizes of collections
---
 .../tag/composite/CompositeComponentResourceTagHandler.java       | 8 +++-----
 .../myfaces/view/facelets/tag/composite/ExtensionHandler.java     | 3 +--
 .../apache/myfaces/view/facelets/tag/composite/FacetHandler.java  | 5 ++---
 .../view/facelets/tag/composite/ImplementationHandler.java        | 5 ++---
 .../myfaces/view/facelets/tag/composite/InsertFacetHandler.java   | 6 +++---
 .../myfaces/view/facelets/tag/composite/RenderFacetHandler.java   | 6 ++----
 6 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java
b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java
index 23e48f8..c88a958 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java
@@ -146,7 +146,7 @@ public class CompositeComponentResourceTagHandler extends ComponentHandler
                 if (ve != null)
                 {
                     Object value = ve.getValue (facesContext.getELContext());
-                    Boolean required = null;
+                    Boolean required;
                     if (value instanceof Boolean)
                     {
                         required = (Boolean) value;
@@ -591,8 +591,7 @@ public class CompositeComponentResourceTagHandler extends ComponentHandler
                         while (children.size() > 0)
                         {
                             UIComponent child = children.remove(0);
-                            child.getAttributes().put(InsertChildrenHandler.INSERT_CHILDREN_USED,
-                                    Boolean.TRUE);
+                            child.getAttributes().put(InsertChildrenHandler.INSERT_CHILDREN_USED,
Boolean.TRUE);
                             if (facetName != null)
                             {
                                 ComponentSupport.addFacet(ctx, parent, child, facetName);
@@ -640,8 +639,7 @@ public class CompositeComponentResourceTagHandler extends ComponentHandler
                     {
                         children = new ArrayList<UIComponent>();
                         UIComponent child = parent.getFacet(facetName);
-                        if (Boolean.TRUE.equals(child.getAttributes().get(
-                                    InsertChildrenHandler.INSERT_CHILDREN_USED)))
+                        if (Boolean.TRUE.equals(child.getAttributes().get(InsertChildrenHandler.INSERT_CHILDREN_USED)))
                         {
                             parent.getFacets().remove(facetName);
                             children.add(child);
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/ExtensionHandler.java
b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/ExtensionHandler.java
index 1b0c48f..8651172 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/ExtensionHandler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/ExtensionHandler.java
@@ -53,8 +53,7 @@ public class ExtensionHandler extends TagHandler
         // As soon JSR-276 is available, some behavior for this tag
         // should be added.
         CompositeComponentBeanInfo beanInfo = 
-            (CompositeComponentBeanInfo) parent.getAttributes()
-            .get(UIComponent.BEANINFO_KEY);
+            (CompositeComponentBeanInfo) parent.getAttributes().get(UIComponent.BEANINFO_KEY);
         
         if (beanInfo == null)
         {
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/FacetHandler.java
b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/FacetHandler.java
index feb2901..866767e 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/FacetHandler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/FacetHandler.java
@@ -206,8 +206,7 @@ public class FacetHandler extends TagHandler implements InterfaceDescriptorCreat
     public void apply(FaceletContext ctx, UIComponent parent) throws IOException
     {
         CompositeComponentBeanInfo beanInfo = 
-            (CompositeComponentBeanInfo) parent.getAttributes()
-            .get(UIComponent.BEANINFO_KEY);
+            (CompositeComponentBeanInfo) parent.getAttributes().get(UIComponent.BEANINFO_KEY);
         
         if (beanInfo == null)
         {
@@ -225,7 +224,7 @@ public class FacetHandler extends TagHandler implements InterfaceDescriptorCreat
         
         if (facetPropertyDescriptorMap == null)
         {
-            facetPropertyDescriptorMap = new HashMap<String, PropertyDescriptor>();
+            facetPropertyDescriptorMap = new HashMap<>(5);
             beanDescriptor.setValue(UIComponent.FACETS_KEY, facetPropertyDescriptorMap);
         }
         
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/ImplementationHandler.java
b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/ImplementationHandler.java
index ddf9940..dee4562 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/ImplementationHandler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/ImplementationHandler.java
@@ -71,8 +71,7 @@ public class ImplementationHandler extends TagHandler
                     = FaceletCompositionContext.getCurrentInstance(ctx).getCompositeComponentFromStack();
             // Register the facet UIComponent.COMPOSITE_FACET_NAME
             CompositeComponentBeanInfo beanInfo = 
-                (CompositeComponentBeanInfo) compositeBaseParent.getAttributes()
-                .get(UIComponent.BEANINFO_KEY);
+                (CompositeComponentBeanInfo) compositeBaseParent.getAttributes().get(UIComponent.BEANINFO_KEY);
             
             if (beanInfo == null)
             {
@@ -90,7 +89,7 @@ public class ImplementationHandler extends TagHandler
         
             if (facetPropertyDescriptorMap == null)
             {
-                facetPropertyDescriptorMap = new HashMap<String, PropertyDescriptor>();
+                facetPropertyDescriptorMap = new HashMap<>(5);
                 beanDescriptor.setValue(UIComponent.FACETS_KEY, facetPropertyDescriptorMap);
             }
             
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/InsertFacetHandler.java
b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/InsertFacetHandler.java
index b00651f..6bd1c18 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/InsertFacetHandler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/InsertFacetHandler.java
@@ -120,7 +120,7 @@ public class InsertFacetHandler extends TagHandler
             if (facetList == null)
             {
                 //2. If not found create it and set
-                facetList = new ArrayList<String>();
+                facetList = new ArrayList<String>(5);
                 beanDescriptor.setValue(INSERT_FACET_USED, facetList);
             }
             
@@ -131,7 +131,7 @@ public class InsertFacetHandler extends TagHandler
         
             if (insertFacetPropertyDescriptorMap == null)
             {
-                insertFacetPropertyDescriptorMap = new HashMap<String, PropertyDescriptor>();
+                insertFacetPropertyDescriptorMap = new HashMap<>(5);
                 beanDescriptor.setValue(INSERT_FACET_KEYS, insertFacetPropertyDescriptorMap);
             }
             
@@ -150,7 +150,7 @@ public class InsertFacetHandler extends TagHandler
     }
     
     private PropertyDescriptor _createFacetPropertyDescriptor(String facetName, FaceletContext
ctx)
-    throws TagException, IOException
+            throws TagException, IOException
     {
         try
         {
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/RenderFacetHandler.java
b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/RenderFacetHandler.java
index 15856df..4800323 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/RenderFacetHandler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/RenderFacetHandler.java
@@ -106,10 +106,8 @@ public class RenderFacetHandler extends ComponentHandler
             if (facetList == null)
             {
                 //2. If not found create it and set
-                facetList = new ArrayList<String>();
-                beanDescriptor.setValue(
-                        RENDER_FACET_USED,
-                        facetList);
+                facetList = new ArrayList<String>(5);
+                beanDescriptor.setValue(RENDER_FACET_USED, facetList);
             }
             
             facetList.add(facetName);


Mime
View raw message