cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject cayenne git commit: Code cleanup
Date Fri, 13 Jul 2018 12:43:39 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 90a0fd48b -> 2b88aa230


Code cleanup


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

Branch: refs/heads/master
Commit: 2b88aa230c70d2a6e770992f8b2bdf0f12ff3ecb
Parents: 90a0fd4
Author: Nikita Timofeev <stariy95@gmail.com>
Authored: Fri Jul 13 15:43:33 2018 +0300
Committer: Nikita Timofeev <stariy95@gmail.com>
Committed: Fri Jul 13 15:43:33 2018 +0300

----------------------------------------------------------------------
 .../apache/cayenne/project/ConfigurationSaver.java | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/2b88aa23/cayenne-project/src/main/java/org/apache/cayenne/project/ConfigurationSaver.java
----------------------------------------------------------------------
diff --git a/cayenne-project/src/main/java/org/apache/cayenne/project/ConfigurationSaver.java
b/cayenne-project/src/main/java/org/apache/cayenne/project/ConfigurationSaver.java
index 1aab516..6546856 100644
--- a/cayenne-project/src/main/java/org/apache/cayenne/project/ConfigurationSaver.java
+++ b/cayenne-project/src/main/java/org/apache/cayenne/project/ConfigurationSaver.java
@@ -19,13 +19,13 @@
 package org.apache.cayenne.project;
 
 import java.io.PrintWriter;
-import java.util.Collection;
 
 import org.apache.cayenne.configuration.BaseConfigurationNodeVisitor;
 import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.project.extension.SaverDelegate;
 import org.apache.cayenne.util.XMLEncoder;
+import org.apache.cayenne.util.XMLSerializable;
 
 /**
  * @since 3.1
@@ -44,23 +44,20 @@ class ConfigurationSaver extends BaseConfigurationNodeVisitor<Void>
{
 
     @Override
     public Void visitDataChannelDescriptor(DataChannelDescriptor node) {
-        XMLEncoder encoder = new XMLEncoder(printWriter, "\t", version);
-        printXMLHeader(encoder);
-        delegate.setXMLEncoder(encoder);
-        node.encodeAsXML(encoder, delegate);
+        encodeNode(node);
         return null;
     }
 
     @Override
     public Void visitDataMap(DataMap node) {
-        XMLEncoder encoder = new XMLEncoder(printWriter, "\t", version);
-        printXMLHeader(encoder);
-        delegate.setXMLEncoder(encoder);
-        node.encodeAsXML(encoder, delegate);
+        encodeNode(node);
         return null;
     }
 
-    private void printXMLHeader(XMLEncoder encoder) {
+    private void encodeNode(XMLSerializable node) {
+        XMLEncoder encoder = new XMLEncoder(printWriter, "\t", version);
         encoder.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
+        delegate.setXMLEncoder(encoder);
+        node.encodeAsXML(encoder, delegate);
     }
 }


Mime
View raw message