myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r938192 - /myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/GenericRenderKitWrapperFactory.java
Date Mon, 26 Apr 2010 18:55:58 GMT
Author: gpetracek
Date: Mon Apr 26 18:55:57 2010
New Revision: 938192

URL: http://svn.apache.org/viewvc?rev=938192&view=rev
Log:
EXTVAL-80 intermediate solution - cache for wrapped render-kit

Modified:
    myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/GenericRenderKitWrapperFactory.java

Modified: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/GenericRenderKitWrapperFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/GenericRenderKitWrapperFactory.java?rev=938192&r1=938191&r2=938192&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/GenericRenderKitWrapperFactory.java
(original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/GenericRenderKitWrapperFactory.java
Mon Apr 26 18:55:57 2010
@@ -23,6 +23,8 @@ import org.apache.myfaces.extensions.val
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
 
 import javax.faces.render.RenderKit;
+import java.util.Map;
+import java.util.HashMap;
 
 /**
  * @author Gerhard Petracek
@@ -31,10 +33,19 @@ import javax.faces.render.RenderKit;
 @UsageInformation(UsageCategory.INTERNAL)
 public class GenericRenderKitWrapperFactory extends AbstractRenderKitWrapperFactory
 {
+    private Map<Class<? extends RenderKit>, RenderKit> renderKitCache =
+            new HashMap<Class<? extends RenderKit>, RenderKit>();
+
     protected RenderKit createWrapper(RenderKit renderKit)
     {
         logger.finest("extval renderkit wrapper created for " + renderKit.getClass().getName()
+ " via cglib");
 
-        return ExtValGenericRenderKit.newInstance(renderKit);
+        if(!this.renderKitCache.containsKey(renderKit.getClass()))
+        {
+            RenderKit wrappedRenderKit = ExtValGenericRenderKit.newInstance(renderKit);
+            this.renderKitCache.put(renderKit.getClass(), wrappedRenderKit);
+        }
+
+        return this.renderKitCache.get(renderKit.getClass());
     }
-}
+}
\ No newline at end of file



Mime
View raw message