From c361213067c609477ab2e1a032ca4f34be4e5db2 Mon Sep 17 00:00:00 2001 From: Alexander Hellwig Date: Wed, 16 Oct 2024 14:35:06 +0200 Subject: [PATCH] Add getNumberAsShort and getNumberAsByte to JsonNumber To be used in umlp --- .../serialization/json/JsonNumber.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/monticore-runtime/src/main/java/de/monticore/symboltable/serialization/json/JsonNumber.java b/monticore-runtime/src/main/java/de/monticore/symboltable/serialization/json/JsonNumber.java index bcc8ae5d1..7d823fd31 100644 --- a/monticore-runtime/src/main/java/de/monticore/symboltable/serialization/json/JsonNumber.java +++ b/monticore-runtime/src/main/java/de/monticore/symboltable/serialization/json/JsonNumber.java @@ -93,6 +93,22 @@ public long getNumberAsLong() { public void setNumber(long value) { this.value = value + ""; } + + public short getNumberAsShort() { + return Short.parseShort(value); + } + + public void setNumber(short value) { + this.value = value + ""; + } + + public byte getNumberAsByte() { + return Byte.parseByte(value); + } + + public void setNumber(byte value) { + this.value = value + ""; + } @Override public String toString() {