[seam-commits] Seam SVN: r11900 - in modules/remoting/trunk/src/main: resources/org/jboss/seam/remoting and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Sun Jan 3 06:47:13 EST 2010


Author: shane.bryzak at jboss.com
Date: 2010-01-03 06:47:13 -0500 (Sun, 03 Jan 2010)
New Revision: 11900

Modified:
   modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/MetadataCache.java
   modules/remoting/trunk/src/main/resources/org/jboss/seam/remoting/remote.js
Log:
move closures out of local variable scope


Modified: modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/MetadataCache.java
===================================================================
--- modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/MetadataCache.java	2010-01-03 09:45:39 UTC (rev 11899)
+++ modules/remoting/trunk/src/main/java/org/jboss/seam/remoting/MetadataCache.java	2010-01-03 11:47:13 UTC (rev 11900)
@@ -120,7 +120,10 @@
    
    private void addBeanDependencies(Class<?> beanClass, Set<BeanMetadata> types)
    {
-      types.add(getMetadata(beanClass));
+      BeanMetadata meta = getMetadata(beanClass);
+      if (types.contains(meta)) return;
+      
+      types.add(meta);
    
       for (Class<?> dependencyClass : getDependencies(beanClass))
       {

Modified: modules/remoting/trunk/src/main/resources/org/jboss/seam/remoting/remote.js
===================================================================
--- modules/remoting/trunk/src/main/resources/org/jboss/seam/remoting/remote.js	2010-01-03 09:45:39 UTC (rev 11899)
+++ modules/remoting/trunk/src/main/resources/org/jboss/seam/remoting/remote.js	2010-01-03 11:47:13 UTC (rev 11900)
@@ -36,6 +36,14 @@
   return Seam.beans[name] != null;
 }
 
+Seam.createSetterMethod = function(fieldName) {
+  return function(value) { this[fieldName] = value; }; 
+}
+
+Seam.createGetterMethod = function(fieldName) {
+  return function() { return this[fieldName]; }; 
+}
+
 Seam.registerBean = function(name, metadata, methods) {
   if (Seam.isBeanRegistered(name)) return;
   var t = function() {};
@@ -43,9 +51,9 @@
   if (metadata) {
     var m = [];
     for (var f in metadata) {
-      var s = f.substring(0,1).toUpperCase() + f.substring(1);
-      t.prototype["set" + s] = function(value) { this[f] = value; };
-      t.prototype["get" + s] = function() { return this[f]; };
+      var s = f.substring(0,1).toUpperCase() + f.substring(1);      
+      t.prototype["set" + s] = Seam.createSetterMethod(f);
+      t.prototype["get" + s] = Seam.createGetterMethod(f);
       m.push({field:f, type:metadata[f]});
     }
     t.__metadata = m;



More information about the seam-commits mailing list