You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2010/04/24 00:52:33 UTC
svn commit: r937547 -
/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponentBase.java
Author: lu4242
Date: Fri Apr 23 22:52:33 2010
New Revision: 937547
URL: http://svn.apache.org/viewvc?rev=937547&view=rev
Log:
MYFACES-2672 Don't create more wrappers for _behaviorsMap than necessary
Modified:
myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponentBase.java
Modified: myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponentBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponentBase.java?rev=937547&r1=937546&r2=937547&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponentBase.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponentBase.java Fri Apr 23 22:52:33 2010
@@ -107,6 +107,7 @@ public abstract class UIComponentBase ex
*
*/
private Map<String, List<ClientBehavior>> _behaviorsMap = null;
+ private transient Map<String, List<ClientBehavior>> _unmodifiableBehaviorsMap = null;
public UIComponentBase()
{
@@ -1656,6 +1657,7 @@ public abstract class UIComponentBase ex
Map<String, Object> stateMap = (Map<String, Object>) stateObj;
int initCapacity = (stateMap.size() * 4 + 3) / 3;
_behaviorsMap = new HashMap<String, List<ClientBehavior> >(initCapacity);
+ _unmodifiableBehaviorsMap = null;
for (Map.Entry<String, Object> entry : stateMap.entrySet())
{
_behaviorsMap.put(entry.getKey(), (List<ClientBehavior>) restoreAttachedState(facesContext, entry.getValue()));
@@ -1664,6 +1666,7 @@ public abstract class UIComponentBase ex
else
{
_behaviorsMap = null;
+ _unmodifiableBehaviorsMap = null;
}
}
@@ -1672,6 +1675,7 @@ public abstract class UIComponentBase ex
{
if (stateObj != null)
{
+ _unmodifiableBehaviorsMap = null;
Map<String, Object> stateMap = (Map<String, Object>) stateObj;
int initCapacity = (stateMap.size() * 4 + 3) / 3;
if (_behaviorsMap == null)
@@ -2011,6 +2015,10 @@ public abstract class UIComponentBase ex
private Map<String, List<ClientBehavior>> wrapBehaviorsMap()
{
- return Collections.unmodifiableMap(_behaviorsMap);
+ if (_unmodifiableBehaviorsMap == null)
+ {
+ _unmodifiableBehaviorsMap = Collections.unmodifiableMap(_behaviorsMap);
+ }
+ return _unmodifiableBehaviorsMap;
}
}