| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1721,6 +1721,9 @@ public static String valueToString(Object value) throws JSONException { | |||
| 1721 | 1721 | if (value.getClass().isArray()) { | |
| 1722 | 1722 | return new JSONArray(value).toString(); | |
| 1723 | 1723 | } | |
| 1724 | + if(value instanceof Enum<?>){ | ||
| 1725 | + return quote(((Enum<?>)value).name()); | ||
| 1726 | + } | ||
| 1724 | 1727 | return quote(value.toString()); | |
| 1725 | 1728 | } | |
| 1726 | 1729 | ||
@@ -1748,7 +1751,7 @@ public static Object wrap(Object object) { | |||
| 1748 | 1751 | || object instanceof Long || object instanceof Boolean | |
| 1749 | 1752 | || object instanceof Float || object instanceof Double | |
| 1750 | 1753 | || object instanceof String || object instanceof BigInteger | |
| 1751 | - || object instanceof BigDecimal) { | ||
| 1754 | + || object instanceof BigDecimal || object instanceof Enum) { | ||
| 1752 | 1755 | return object; | |
| 1753 | 1756 | } | |
| 1754 | 1757 | ||
@@ -1818,6 +1821,8 @@ static final Writer writeValue(Writer writer, Object value, | |||
| 1818 | 1821 | } | |
| 1819 | 1822 | } else if (value instanceof Boolean) { | |
| 1820 | 1823 | writer.write(value.toString()); | |
| 1824 | + } else if (value instanceof Enum<?>) { | ||
| 1825 | + writer.write(quote(((Enum<?>)value).name())); | ||
| 1821 | 1826 | } else if (value instanceof JSONObject) { | |
| 1822 | 1827 | ((JSONObject) value).write(writer, indentFactor, indent); | |
| 1823 | 1828 | } else if (value instanceof JSONArray) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments