| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1710,6 +1710,9 @@ public static String valueToString(Object value) throws JSONException { | |||
| 1710 | 1710 | if (value.getClass().isArray()) { | |
| 1711 | 1711 | return new JSONArray(value).toString(); | |
| 1712 | 1712 | } | |
| 1713 | + if(value instanceof Enum<?>){ | ||
| 1714 | + return quote(((Enum<?>)value).name()); | ||
| 1715 | + } | ||
| 1713 | 1716 | return quote(value.toString()); | |
| 1714 | 1717 | } | |
| 1715 | 1718 | ||
@@ -1737,7 +1740,7 @@ public static Object wrap(Object object) { | |||
| 1737 | 1740 | || object instanceof Long || object instanceof Boolean | |
| 1738 | 1741 | || object instanceof Float || object instanceof Double | |
| 1739 | 1742 | || object instanceof String || object instanceof BigInteger | |
| 1740 | - || object instanceof BigDecimal) { | ||
| 1743 | + || object instanceof BigDecimal || object instanceof Enum) { | ||
| 1741 | 1744 | return object; | |
| 1742 | 1745 | } | |
| 1743 | 1746 | ||
@@ -1799,6 +1802,8 @@ static final Writer writeValue(Writer writer, Object value, | |||
| 1799 | 1802 | writer.write(numberToString((Number) value)); | |
| 1800 | 1803 | } else if (value instanceof Boolean) { | |
| 1801 | 1804 | writer.write(value.toString()); | |
| 1805 | + } else if (value instanceof Enum<?>) { | ||
| 1806 | + writer.write(quote(((Enum<?>)value).name())); | ||
| 1802 | 1807 | } else if (value instanceof JSONString) { | |
| 1803 | 1808 | Object o; | |
| 1804 | 1809 | try { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments