Number (@NotNull JsonValueAdapter value) { Number numberValue; try { numberValue = Integer.parseInt(value.getDelegate().getText()); } catch (NumberFormatException e) { try { numberValue = Double.parseDouble(value.getDelegate().getText()); } catch (NumberFormatException e2) { return -1; } } return numberValue; }