code: @SuppressWarnings("unchecked")
      public <T extends Number> T readBodyAsNumber(Class<T> type) {
          String messageContent = readBodyAndValidateForNumber();
          if (type.equals(BigDecimal.class)) {
              return (T)new BigDecimal(messageContent);
          } else if (type.equals(BigInteger.class)) {
              return (T)new BigInteger(messageContent);
          } else if (type.equals(Byte.class)) {
              return (T)Byte.valueOf(messageContent);
          } else if (type.equals(Short.class)) {
              return (T)Short.valueOf(messageContent);
          } else if (type.equals(Integer.class)) {
              return (T)Integer.valueOf(messageContent);
          } else if (type.equals(Long.class)) {
              return (T)Long.valueOf(messageContent);
          } else {
              throw new RuntimeException("Unsupported number format: " + type);
          }
      }
docs: Extracts the message body and interprets it
  as the given number (e.g. Integer) .
  
  @param type The number type
  @return The message body as the specified number