ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sevdoki...@apache.org
Subject [22/50] incubator-ignite git commit: IGNITE-843 Do not generate value if it is equals to default.
Date Fri, 31 Jul 2015 07:47:04 GMT
IGNITE-843 Do not generate value if it is equals to default.


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

Branch: refs/heads/ignite-1155_1
Commit: e1adcd012e626bcd86e1d90f091f9c443fdb2fbd
Parents: 9d3a3ef
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Thu Jul 30 16:36:46 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Thu Jul 30 16:36:46 2015 +0700

----------------------------------------------------------------------
 .../src/main/js/routes/generator/java.js            | 16 ++++++++++++++--
 .../src/main/js/routes/generator/xml.js             | 12 ++++++++++--
 2 files changed, 24 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1adcd01/modules/control-center-web/src/main/js/routes/generator/java.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/generator/java.js b/modules/control-center-web/src/main/js/routes/generator/java.js
index 573418d..d737780 100644
--- a/modules/control-center-web/src/main/js/routes/generator/java.js
+++ b/modules/control-center-web/src/main/js/routes/generator/java.js
@@ -480,14 +480,14 @@ function addCacheConfiguration(res, cache, varName) {
         addProperty(res, varName, cache, 'backups');
 
     addProperty(res, varName, cache, 'startSize');
-    addProperty(res, varName, cache, 'readFromBackup');
+    addPropertyIfNotDefault(res, varName, cache, 'readFromBackup', true);
 
     res.needEmptyLine = true;
 
     addProperty(res, varName, cache, 'memoryMode', 'CacheMemoryMode');
     addProperty(res, varName, cache, 'offHeapMaxMemory');
     addProperty(res, varName, cache, 'swapEnabled');
-    addProperty(res, varName, cache, 'copyOnRead');
+    addPropertyIfNotDefault(res, varName, cache, 'copyOnRead', true);
 
     res.needEmptyLine = true;
 
@@ -725,6 +725,18 @@ function addProperty(res, varName, obj, propName, enumType, setterName)
{
     return val;
 }
 
+function addPropertyIfNotDefault(res, varName, obj, propName, dflt) {
+    var val = obj[propName];
+
+    if (generatorUtils.isDefined(val) && val != dflt) {
+        res.emptyLineIfNeeded();
+
+        res.line(varName + '.' + getSetterName(setterName ? setterName : propName)
+            + '(' + toJavaCode(val, enumType) + ');');
+    }
+}
+
+
 /**
  * Add property via setter assuming that it is a 'Class'.
  *

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1adcd01/modules/control-center-web/src/main/js/routes/generator/xml.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/generator/xml.js b/modules/control-center-web/src/main/js/routes/generator/xml.js
index d6bc1c3..9a893a6 100644
--- a/modules/control-center-web/src/main/js/routes/generator/xml.js
+++ b/modules/control-center-web/src/main/js/routes/generator/xml.js
@@ -465,14 +465,15 @@ function generateCacheConfiguration(res, cacheCfg) {
         addProperty(res, cacheCfg, 'backups');
 
     addProperty(res, cacheCfg, 'startSize');
-    addProperty(res, cacheCfg, 'readFromBackup');
+
+    addPropertyIfNotDefault(res, cacheCfg, 'readFromBackup', true);
 
     res.needEmptyLine = true;
 
     addProperty(res, cacheCfg, 'memoryMode');
     addProperty(res, cacheCfg, 'offHeapMaxMemory');
     addProperty(res, cacheCfg, 'swapEnabled');
-    addProperty(res, cacheCfg, 'copyOnRead');
+    addPropertyIfNotDefault(res, cacheCfg, 'copyOnRead', true);
 
     res.needEmptyLine = true;
 
@@ -645,6 +646,13 @@ function addProperty(res, obj, propName, setterName) {
     return val;
 }
 
+function addPropertyIfNotDefault(res, obj, propName, dflt) {
+    var val = obj[propName];
+
+    if (generatorUtils.isDefined(val) && val != dflt)
+        addElement(res, 'property', 'name', propName, 'value', escapeAttr(val));
+}
+
 function addBeanWithProperties(res, bean, beanPropName, beanClass, props, createBeanAlthoughNoProps)
{
     if (bean && generatorUtils.hasProperty(bean, props)) {
         res.emptyLineIfNeeded();


Mime
View raw message