groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Move `YamlConverter` to an internal package
Date Sat, 06 Oct 2018 04:06:03 GMT
Repository: groovy
Updated Branches:
  refs/heads/master 075ed9b26 -> 31b206d1c


Move `YamlConverter` to an internal package


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

Branch: refs/heads/master
Commit: 31b206d1c54f29e3637d75f0676b9d017eeab14a
Parents: 075ed9b
Author: Daniel Sun <sunlan@apache.org>
Authored: Sat Oct 6 12:05:57 2018 +0800
Committer: Daniel Sun <sunlan@apache.org>
Committed: Sat Oct 6 12:05:57 2018 +0800

----------------------------------------------------------------------
 .../src/main/java/groovy/yaml/YamlBuilder.java  |  2 +-
 .../src/main/java/groovy/yaml/YamlSlurper.java  |  3 +-
 .../java/groovy/yaml/util/YamlConverter.java    | 66 --------------------
 .../apache/groovy/yaml/util/YamlConverter.java  | 66 ++++++++++++++++++++
 4 files changed, 68 insertions(+), 69 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/31b206d1/subprojects/groovy-yaml/src/main/java/groovy/yaml/YamlBuilder.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-yaml/src/main/java/groovy/yaml/YamlBuilder.java b/subprojects/groovy-yaml/src/main/java/groovy/yaml/YamlBuilder.java
index ef9cf6a..34f8606 100644
--- a/subprojects/groovy-yaml/src/main/java/groovy/yaml/YamlBuilder.java
+++ b/subprojects/groovy-yaml/src/main/java/groovy/yaml/YamlBuilder.java
@@ -22,7 +22,7 @@ import groovy.json.JsonBuilder;
 import groovy.lang.Closure;
 import groovy.lang.GroovyObjectSupport;
 import groovy.lang.Writable;
-import groovy.yaml.util.YamlConverter;
+import org.apache.groovy.yaml.util.YamlConverter;
 
 import java.io.IOException;
 import java.io.StringReader;

http://git-wip-us.apache.org/repos/asf/groovy/blob/31b206d1/subprojects/groovy-yaml/src/main/java/groovy/yaml/YamlSlurper.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-yaml/src/main/java/groovy/yaml/YamlSlurper.java b/subprojects/groovy-yaml/src/main/java/groovy/yaml/YamlSlurper.java
index 057b94c..6e8d9e7 100644
--- a/subprojects/groovy-yaml/src/main/java/groovy/yaml/YamlSlurper.java
+++ b/subprojects/groovy-yaml/src/main/java/groovy/yaml/YamlSlurper.java
@@ -19,9 +19,8 @@
 package groovy.yaml;
 
 import groovy.json.JsonSlurper;
-import groovy.yaml.util.YamlConverter;
+import org.apache.groovy.yaml.util.YamlConverter;
 
-import java.io.IOException;
 import java.io.Reader;
 import java.io.StringReader;
 

http://git-wip-us.apache.org/repos/asf/groovy/blob/31b206d1/subprojects/groovy-yaml/src/main/java/groovy/yaml/util/YamlConverter.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-yaml/src/main/java/groovy/yaml/util/YamlConverter.java b/subprojects/groovy-yaml/src/main/java/groovy/yaml/util/YamlConverter.java
deleted file mode 100644
index 41192d2..0000000
--- a/subprojects/groovy-yaml/src/main/java/groovy/yaml/util/YamlConverter.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package groovy.yaml.util;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
-import com.fasterxml.jackson.dataformat.yaml.YAMLMapper;
-import groovy.yaml.YamlRuntimeException;
-
-import java.io.IOException;
-import java.io.Reader;
-
-/**
- *  A converter for converting YAML to JSON, vice versa
- *  @since 3.0.0
- */
-public class YamlConverter {
-    /**
-     * Convert yaml to json
-     * @param yamlReader the reader of yaml
-     * @return the text of json
-     */
-    public static String convertYamlToJson(Reader yamlReader) {
-        try (Reader reader = yamlReader) {
-            Object yaml = new ObjectMapper(new YAMLFactory()).readValue(reader, Object.class);
-
-            return new ObjectMapper().writeValueAsString(yaml);
-        } catch (IOException e) {
-            throw new YamlRuntimeException(e);
-        }
-    }
-
-    /**
-     * Convert json to yaml
-     * @param jsonReader the reader of json
-     * @return the text of yaml
-     */
-    public static String convertJsonToYaml(Reader jsonReader) {
-        try (Reader reader = jsonReader) {
-            JsonNode json = new ObjectMapper().readTree(reader);
-
-            return new YAMLMapper().writeValueAsString(json);
-        } catch (IOException e) {
-            throw new YamlRuntimeException(e);
-        }
-    }
-
-    private YamlConverter() {}
-}

http://git-wip-us.apache.org/repos/asf/groovy/blob/31b206d1/subprojects/groovy-yaml/src/main/java/org/apache/groovy/yaml/util/YamlConverter.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-yaml/src/main/java/org/apache/groovy/yaml/util/YamlConverter.java
b/subprojects/groovy-yaml/src/main/java/org/apache/groovy/yaml/util/YamlConverter.java
new file mode 100644
index 0000000..ba59bab
--- /dev/null
+++ b/subprojects/groovy-yaml/src/main/java/org/apache/groovy/yaml/util/YamlConverter.java
@@ -0,0 +1,66 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.groovy.yaml.util;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
+import com.fasterxml.jackson.dataformat.yaml.YAMLMapper;
+import groovy.yaml.YamlRuntimeException;
+
+import java.io.IOException;
+import java.io.Reader;
+
+/**
+ *  A converter for converting YAML to JSON, vice versa
+ *  @since 3.0.0
+ */
+public class YamlConverter {
+    /**
+     * Convert yaml to json
+     * @param yamlReader the reader of yaml
+     * @return the text of json
+     */
+    public static String convertYamlToJson(Reader yamlReader) {
+        try (Reader reader = yamlReader) {
+            Object yaml = new ObjectMapper(new YAMLFactory()).readValue(reader, Object.class);
+
+            return new ObjectMapper().writeValueAsString(yaml);
+        } catch (IOException e) {
+            throw new YamlRuntimeException(e);
+        }
+    }
+
+    /**
+     * Convert json to yaml
+     * @param jsonReader the reader of json
+     * @return the text of yaml
+     */
+    public static String convertJsonToYaml(Reader jsonReader) {
+        try (Reader reader = jsonReader) {
+            JsonNode json = new ObjectMapper().readTree(reader);
+
+            return new YAMLMapper().writeValueAsString(json);
+        } catch (IOException e) {
+            throw new YamlRuntimeException(e);
+        }
+    }
+
+    private YamlConverter() {}
+}


Mime
View raw message