code: private Long handleToId(Object handle) {
          if (handle instanceof Long) {
              return (Long) handle;
          } else {
              throw new IllegalArgumentException("Expected handle to be a Long, but was: " +
                      handle.getClass().getCanonicalName());
          }
      }
docs: Converts an opaque handle into a long ID. If the handle is not a Long, this will throw an
  {@link java.lang.IllegalArgumentException}.
  
  @param handle The handle to convert to an ID.
  @return The ID.