code: @SuppressWarnings("unchecked")
    public Query withContentType(String contentType) {
      checkNotEmpty(contentType, "ContentType must not be empty.");
  
      if (hasContentTypeSet()) {
        throw new IllegalStateException(
            format("ContentType \"%s\" is already present in query.", contentType)
        );
      } else {
        params.put(PARAMETER_CONTENT_TYPE, contentType);
      }
  
      return (Query) this;
    }
docs: Requesting a specific content type.
  <p>
  The content type is especially useful if you want to limit the result of this query to only one
  content model type.
  <p>
  You must specify a content type <b>before</b> querying a specific <b>field</b> on a query, an
  exception will be thrown otherwise.
  
  @param contentType the content type to be used.
  @return the calling query for chaining.
  @throws IllegalArgumentException if contentType is null.
  @throws IllegalArgumentException if contentType is empty.
  @throws IllegalStateException    if contentType was set before.