code: private Object convertReturnValue(Object result) {
      if (boolean.class.isInstance(result) || result instanceof Boolean) {
        return ScriptExtensionUtils.computeReturnObject(1, ((Boolean) result).booleanValue(), 0, 0.0, null);
  
      } else if (long.class.isInstance(result)) {
        return (Long) result;
  
      } else if (int.class.isInstance(result) || result instanceof Integer) {
        return new Long((Integer) result);
  
      } else if (double.class.isInstance(result)) {
        return (Double) result;
  
      }
  
      // String/Double/Long/Float
      return result;
    }
docs: Convert the method return value into a PageMerger internal type of String,
  Long or Double
  
  @param result
  @return