Skip to content

Commit

Permalink
use toPlainString for BigDecimal
Browse files Browse the repository at this point in the history
  • Loading branch information
tvd12 committed Nov 22, 2024
1 parent d08b772 commit 8444621
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,4 @@ public static EzyDefaultWriter getInstance() {
public Object write(EzyMarshaller marshaller, Object object) {
return object;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ public EzyArray write(EzyMarshaller marshaller, Iterable iterable) {
}
return builder.build();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected void addParsers(Map<Class<?>, EzyParser<Object, byte[]>> parsers) {
parsers.put(ArrayList.class, this::parseCollection);

parsers.put(BigInteger.class, this::parseValueToString);
parsers.put(BigDecimal.class, this::parseValueToString);
parsers.put(BigDecimal.class, this::parseBigDecimalToString);
parsers.put(UUID.class, this::parseValueToString);
}

Expand Down Expand Up @@ -385,6 +385,10 @@ protected byte[] parseMapSize(int size) {
return mapSizeSerializer.serialize(size);
}

protected byte[] parseBigDecimalToString(Object value) {
return parseString(((BigDecimal) value).toPlainString());
}

protected byte[] parseValueToString(Object value) {
return parseString(value.toString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ protected void addParsers(Map<Class<?>, EzyParser<Object, ByteBuffer>> parsers)
parsers.put(ArrayList.class, this::parseCollection);

parsers.put(BigInteger.class, this::parseValueToString);
parsers.put(BigDecimal.class, this::parseValueToString);
parsers.put(BigDecimal.class, this::parseBigDecimalToString);
parsers.put(UUID.class, this::parseValueToString);
}

Expand Down Expand Up @@ -384,6 +384,10 @@ protected byte[] parseMapSize(int size) {
return mapSizeSerializer.serialize(size);
}

protected ByteBuffer parseBigDecimalToString(Object value) {
return parseString(((BigDecimal) value).toPlainString());
}

protected ByteBuffer parseValueToString(Object value) {
return parseString(value.toString());
}
Expand Down

0 comments on commit 8444621

Please sign in to comment.