code: protected long convertToLong(final Object fromStack) throws ParseException
      {
          if (fromStack instanceof Number)
              return ((Number) fromStack).longValue();
          if (fromStack instanceof String)
              return Long.parseLong((String) fromStack);
          if (fromStack instanceof LocalDateTime)
              return CalendarFactory.asDateLong((LocalDateTime) fromStack);
  
          final StringBuilder errMsg = new StringBuilder();
          errMsg.append("invalid type ");
          errMsg.append(fromStack.getClass().getSimpleName());
          throw new ParseException(errMsg.toString(), 0);
      }
docs: <p>
  convertToDouble.
  </p>
  
  @param fromStack a {@link java.lang.Object} object.
  @return a double.
  @throws java.text.ParseException if any.