Skip to content

Commit

Permalink
Improve XML to JSON convert logic #243
Browse files Browse the repository at this point in the history
  • Loading branch information
Gelin Luo committed Jan 1, 2021
1 parent 3a9b558 commit 59e73f7
Show file tree
Hide file tree
Showing 26 changed files with 896 additions and 291 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# OSGL Tool Change Log

1.26.2 - 01/Jan/2021
* Improve XML to JSON convert logic #243

1.26.1 - 26/Dec/2020
* Drop `javax.xml.bind` dependency #242
* OS util cannot detect `Mac OS X` #241
Expand Down
9 changes: 3 additions & 6 deletions src/main/java/org/osgl/Lang.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import java.nio.charset.StandardCharsets;
import java.security.SecureRandom;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
Expand Down Expand Up @@ -3214,13 +3213,11 @@ public String convert(Document document, Object hint) {
}
};

public static final TypeConverter<Document, JSONObject> XML_DOCUMENT_TO_JSON = new XmlDocumentToJsonObject();
public static final TypeConverter<Document, JSONObject> XML_DOCUMENT_TO_JSON = new XmlToJson();

public static final TypeConverter<Document, JSONArray> XML_DOCUMENT_TO_JSON_ARRAY = new XmlDocumentToJsonArray();
public static final TypeConverter<JSONObject, Document> JSON_OBJECT_TO_XML_DOCUMENT = new JsonObjectToXml();

public static final TypeConverter<JSONObject, Document> JSON_OBJECT_TO_XML_DOCUMENT = new JsonObjectToXmlDocument();

public static final TypeConverter<JSONArray, Document> JSON_ARRAY_TO_XML_DOCUMENT = new JsonArrayToXmlDocument();
public static final TypeConverter<JSONArray, Document> JSON_ARRAY_TO_XML_DOCUMENT = new JsonArrayToXml();

public static final TypeConverter<Object, JSONObject> ANY_TO_JSON_OBJECT = new TypeConverter<Object, JSONObject>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.osgl.util.S;
import org.w3c.dom.Document;

public class JsonArrayToXmlDocument extends Lang.TypeConverter<JSONArray, Document> {
public class JsonArrayToXml extends Lang.TypeConverter<JSONArray, Document> {
@Override
public Document convert(JSONArray array) {
return JsonXmlConvertHint.convert(array, OsglConfig.xmlRootTag(), OsglConfig.xmlListItemTag());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.osgl.util.S;
import org.w3c.dom.Document;

public class JsonObjectToXmlDocument extends Lang.TypeConverter<JSONObject, Document> {
public class JsonObjectToXml extends Lang.TypeConverter<JSONObject, Document> {
@Override
public Document convert(JSONObject json) {
return JsonXmlConvertHint.convert(json, OsglConfig.xmlRootTag(), OsglConfig.xmlListItemTag());
Expand Down
82 changes: 0 additions & 82 deletions src/main/java/org/osgl/util/converter/XmlDocumentToJsonArray.java

This file was deleted.

46 changes: 0 additions & 46 deletions src/main/java/org/osgl/util/converter/XmlDocumentToJsonObject.java

This file was deleted.

155 changes: 0 additions & 155 deletions src/main/java/org/osgl/util/converter/XmlDocumentToJsonUtil.java

This file was deleted.

Loading

0 comments on commit 59e73f7

Please sign in to comment.