ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject ignite git commit: IGNITE-843 Refactored XML code generation: renamed methods and added jsdocs.
Date Thu, 18 Feb 2016 08:14:53 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843-rc2 cb427d061 -> 36551403d


IGNITE-843 Refactored XML code generation: renamed methods and added jsdocs.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/36551403
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/36551403
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/36551403

Branch: refs/heads/ignite-843-rc2
Commit: 36551403d816507b0226ce5cd8377864091f6446
Parents: cb427d0
Author: vsisko <vsisko@gridgain.com>
Authored: Thu Feb 18 15:15:13 2016 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Thu Feb 18 15:15:13 2016 +0700

----------------------------------------------------------------------
 .../main/js/helpers/generator/generator-xml.js  | 58 ++++++++++++--------
 1 file changed, 36 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/36551403/modules/control-center-web/src/main/js/helpers/generator/generator-xml.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/helpers/generator/generator-xml.js b/modules/control-center-web/src/main/js/helpers/generator/generator-xml.js
index 6d4fd6c..9fab39b 100644
--- a/modules/control-center-web/src/main/js/helpers/generator/generator-xml.js
+++ b/modules/control-center-web/src/main/js/helpers/generator/generator-xml.js
@@ -62,21 +62,6 @@ $generatorXml.property = function (res, obj, propName, setterName, dflt)
{
     return false;
 };
 
-// Add property.
-$generatorXml.emptyBeanProperty = function (res, obj, propName) {
-    if ($commonUtils.isDefined(obj)) {
-        var val = obj[propName];
-
-        if ($commonUtils.isDefinedAndNotEmpty(val)) {
-            res.startBlock('<property name="' + propName + '">');
-            res.line('<bean class="' + val + '"/>');
-            res.endBlock('</property>');
-        }
-    }
-
-    return false;
-};
-
 // Add property for class name.
 $generatorXml.classNameProperty = function (res, obj, propName) {
     var val = obj[propName];
@@ -138,7 +123,15 @@ $generatorXml.arrayProperty = function (res, obj, propName, descr, rowFactory)
{
     }
 };
 
-// Add bean property.
+/**
+ * Add bean property with internal content.
+ *
+ * @param res Optional configuration presentation builder object.
+ * @param bean Bean object for code generation.
+ * @param beanPropName Name of property to set generated bean as value.
+ * @param desc Bean metadata object.
+ * @param createBeanAlthoughNoProps Always generate bean even it has no properties defined.
+ */
 $generatorXml.beanProperty = function (res, bean, beanPropName, desc, createBeanAlthoughNoProps)
{
     var props = desc.fields;
 
@@ -236,6 +229,27 @@ $generatorXml.beanProperty = function (res, bean, beanPropName, desc,
createBean
     }
 };
 
+/**
+ * Add bean property without internal content.
+ *
+ * @param res Optional configuration presentation builder object.
+ * @param obj Object to take bean class name.
+ * @param propName Property name.
+ */
+$generatorXml.simpleBeanProperty = function (res, obj, propName) {
+    if ($commonUtils.isDefined(obj)) {
+        var val = obj[propName];
+
+        if ($commonUtils.isDefinedAndNotEmpty(val)) {
+            res.startBlock('<property name="' + propName + '">');
+            res.line('<bean class="' + val + '"/>');
+            res.endBlock('</property>');
+        }
+    }
+
+    return false;
+};
+
 // Generate eviction policy.
 $generatorXml.evictionPolicy = function (res, evtPlc, propName) {
     if (evtPlc && evtPlc.kind) {
@@ -417,9 +431,9 @@ $generatorXml.clusterBinary = function (cluster, res) {
         res.startBlock('<property name="binaryConfiguration">');
         res.startBlock('<bean class="org.apache.ignite.configuration.BinaryConfiguration">');
 
-        $generatorXml.emptyBeanProperty(res, binary, 'idMapper');
-        $generatorXml.emptyBeanProperty(res, binary, 'serializer');
-        $generatorXml.emptyBeanProperty(res, binary, 'nameMapper');
+        $generatorXml.simpleBeanProperty(res, binary, 'idMapper');
+        $generatorXml.simpleBeanProperty(res, binary, 'serializer');
+        $generatorXml.simpleBeanProperty(res, binary, 'nameMapper');
 
         if ($commonUtils.isDefinedAndNotEmpty(binary.typeConfigurations)) {
             res.startBlock('<property name="typeConfigurations">');
@@ -429,9 +443,9 @@ $generatorXml.clusterBinary = function (cluster, res) {
                 res.startBlock('<bean class="org.apache.ignite.binary.BinaryTypeConfiguration">');
 
                 $generatorXml.property(res, type, 'typeName');
-                $generatorXml.emptyBeanProperty(res, type, 'idMapper');
-                $generatorXml.emptyBeanProperty(res, type, 'nameMapper');
-                $generatorXml.emptyBeanProperty(res, type, 'serializer');
+                $generatorXml.simpleBeanProperty(res, type, 'idMapper');
+                $generatorXml.simpleBeanProperty(res, type, 'nameMapper');
+                $generatorXml.simpleBeanProperty(res, type, 'serializer');
                 $generatorXml.property(res, type, 'enum', undefined, false);
 
                 res.endBlock('</bean>');


Mime
View raw message