Skip to content

Commit

Permalink
keep numbers as string to keep original value
Browse files Browse the repository at this point in the history
  • Loading branch information
rmannibucau committed Mar 24, 2023
1 parent da7a982 commit 634f6e6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/main/java/io/yupiik/yuc/command/DefaultCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void run() {
case VALUE_STRING -> visitor.onString(parser.getString());
case VALUE_TRUE -> visitor.onBoolean(true);
case VALUE_FALSE -> visitor.onBoolean(false);
case VALUE_NUMBER -> visitor.onNumber(parser.getBigDecimal());
case VALUE_NUMBER -> visitor.onNumber(parser.getString());
case VALUE_NULL -> visitor.onNull();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/yupiik/yuc/formatter/JsonVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public interface JsonVisitor {

void onBoolean(boolean value);

void onNumber(Number value);
void onNumber(String value);

void onNull();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ protected String booleanValue(final boolean value) {
return value ? color.onTrue() : color.onFalse();
}

protected String numberValue(final Number value) {
return color.onNumber(String.valueOf(value));
protected String numberValue(final String value) {
return color.onNumber(value);
}

protected String nullValue() {
Expand Down Expand Up @@ -109,7 +109,7 @@ public void onBoolean(final boolean value) {
}

@Override
public void onNumber(final Number value) {
public void onNumber(final String value) {
output.write(numberValue(value));
updateStateAfterValueIfNeeded();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void onBoolean(final boolean value) {
}

@Override
public void onNumber(final Number value) {
public void onNumber(final String value) {
beforeValue();
super.onNumber(value);
}
Expand Down

0 comments on commit 634f6e6

Please sign in to comment.