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 2012/03/07 21:06:55 UTC
svn commit: r1298083 - in
/myfaces/core/trunk/api/src/main/java/javax/faces/component:
UIComponentBase.java _ComponentAttributesMap.java
Author: lu4242
Date: Wed Mar 7 20:06:54 2012
New Revision: 1298083
URL: http://svn.apache.org/viewvc?rev=1298083&view=rev
Log:
MYFACES-3150 [perf] buildView: review usage of "facelets.FACET_NAME"
Modified:
myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponentBase.java
myfaces/core/trunk/api/src/main/java/javax/faces/component/_ComponentAttributesMap.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=1298083&r1=1298082&r2=1298083&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 Wed Mar 7 20:06:54 2012
@@ -102,6 +102,7 @@ public abstract class UIComponentBase ex
private boolean _isRendererTypeSet = false;
private String _rendererType;
private String _markCreated;
+ private String _facetName;
/**
* This map holds ClientBehavior instances.
@@ -2412,6 +2413,16 @@ public abstract class UIComponentBase ex
return _markCreated;
}
+ String getOamVfFacetName()
+ {
+ return _facetName;
+ }
+
+ void setOamVfFacetName(String facetName)
+ {
+ _facetName = facetName;
+ }
+
/**
* <p>
* This gets a single FacesContext-local shared stringbuilder instance, each time you call
Modified: myfaces/core/trunk/api/src/main/java/javax/faces/component/_ComponentAttributesMap.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/_ComponentAttributesMap.java?rev=1298083&r1=1298082&r2=1298083&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/component/_ComponentAttributesMap.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/component/_ComponentAttributesMap.java Wed Mar 7 20:06:54 2012
@@ -62,6 +62,8 @@ class _ComponentAttributesMap implements
private static final Object[] EMPTY_ARGS = new Object[0];
private final static String MARK_CREATED = "oam.vf.MARK_ID";
+
+ private final static String FACET_NAME_KEY = "facelets.FACET_NAME";
// The component that is read/written via this map.
private UIComponentBase _component;
@@ -167,10 +169,21 @@ class _ComponentAttributesMap implements
{
checkKey(key);
+ int keyLength = ((String)key).length();
+ if (MARK_CREATED.length() == keyLength &&
+ MARK_CREATED.equals(key))
+ {
+ return ((UIComponentBase)_component).getOamVfMarkCreated() != null;
+ }
+ else if (FACET_NAME_KEY.length() == keyLength &&
+ FACET_NAME_KEY.equals(key))
+ {
+ return _component.getOamVfFacetName() != null;
+ }
// The most common call to this method comes from UIComponent.isCompositeComponent()
// to reduce the impact. This is better than two lookups, once over property descriptor map
// and the other one from the underlying map.
- if (Resource.COMPONENT_RESOURCE_KEY.length() == ((String)key).length() &&
+ if (Resource.COMPONENT_RESOURCE_KEY.length() == keyLength &&
Resource.COMPONENT_RESOURCE_KEY.equals(key))
{
if (!_isCompositeComponentSet)
@@ -184,12 +197,6 @@ class _ComponentAttributesMap implements
}
return _isCompositeComponent;
}
- if (MARK_CREATED.length() == ((String)key).length() &&
- MARK_CREATED.equals(key))
- {
- return ((UIComponentBase)_component).getOamVfMarkCreated() != null;
- }
-
return getPropertyDescriptor((String) key) == null ? getUnderlyingMap().containsKey(key) : false;
}
@@ -256,11 +263,17 @@ class _ComponentAttributesMap implements
Object value;
- if (MARK_CREATED.length() == ((String)key).length() &&
+ int keyLength = ((String)key).length();
+ if (MARK_CREATED.length() == keyLength &&
MARK_CREATED.equals(key))
{
return _component.getOamVfMarkCreated();
}
+ else if (FACET_NAME_KEY.length() == keyLength &&
+ FACET_NAME_KEY.equals(key))
+ {
+ return _component.getOamVfFacetName();
+ }
// is there a javabean property to read?
_PropertyDescriptorHolder propertyDescriptor = getPropertyDescriptor((String) key);
if (propertyDescriptor != null)
@@ -358,13 +371,21 @@ class _ComponentAttributesMap implements
public Object remove(Object key)
{
checkKey(key);
- if (MARK_CREATED.length() == ((String)key).length() &&
+ int keyLength = ((String)key).length();
+ if (MARK_CREATED.length() == keyLength &&
MARK_CREATED.equals(key))
{
Object oldValue = _component.getOamVfMarkCreated();
_component.setOamVfMarkCreated(null);
return oldValue;
}
+ else if (FACET_NAME_KEY.length() == keyLength &&
+ FACET_NAME_KEY.equals(key))
+ {
+ Object oldValue = _component.getOamVfFacetName();
+ _component.setOamVfFacetName(null);
+ return oldValue;
+ }
_PropertyDescriptorHolder propertyDescriptor = getPropertyDescriptor((String) key);
if (propertyDescriptor != null)
{
@@ -407,7 +428,20 @@ class _ComponentAttributesMap implements
{
throw new NullPointerException("key");
}
-
+ if (MARK_CREATED.length() == key.length() &&
+ MARK_CREATED.equals(key))
+ {
+ String oldValue = _component.getOamVfMarkCreated();
+ _component.setOamVfMarkCreated((String)value);
+ return oldValue;
+ }
+ else if (FACET_NAME_KEY.length() == key.length() &&
+ FACET_NAME_KEY.equals(key))
+ {
+ Object oldValue = _component.getOamVfFacetName();
+ _component.setOamVfFacetName((String)value);
+ return oldValue;
+ }
_PropertyDescriptorHolder propertyDescriptor = getPropertyDescriptor(key);
if (propertyDescriptor == null)
{
@@ -435,13 +469,6 @@ class _ComponentAttributesMap implements
_isCompositeComponent = true;
_isCompositeComponentSet = true;
}
- if (MARK_CREATED.length() == key.length() &&
- MARK_CREATED.equals(key))
- {
- String oldValue = _component.getOamVfMarkCreated();
- _component.setOamVfMarkCreated((String)value);
- return oldValue;
- }
return _component.getStateHelper().put(UIComponentBase.PropertyKeys.attributesMap, key, value);
}