Class Result<T>

java.lang.Object
io.weaviate.client.base.Result<T>

public class Result<T> extends Object
  • Constructor Details

  • Method Details

    • hasErrors

      public boolean hasErrors()
    • toErrorResult

      public <C> Result<C> toErrorResult()
      Copy the Result object with a null body, preserving only the status code and the error message.
      Type Parameters:
      C - Would-be response type. It's required for type safety, but can be anything since the body is always set to null.
      Returns:
      A copy of this Result.
    • voidToBoolean

      public static Result<Boolean> voidToBoolean(Response<Void> response)
      Convert Result<Void> response to a Result<Boolean>. The result contains true if status code is in 100-299 range.
      Parameters:
      response - Response from a call that does not return a value, like BaseClient.sendDeleteRequest(java.lang.String, java.lang.Object, java.lang.Class<T>).
      Returns:
      Result<Boolean>
    • voidToBoolean

      public static Result<Boolean> voidToBoolean(Response<Void> response, int... allowCodes)
      Convert Result<Void> response to a Result<Boolean>. The result contains true if status code is in 100-299 range or is one of the allowed codes (e.g. HTTP 409 is used when the request has no effect, because a previous one has already succeeded).
      Parameters:
      allowCodes - Avoid treating these error codes as an error and only return false.
      response - Response from a call that does not return a value, like BaseClient.sendDeleteRequest(java.lang.String, java.lang.Object, java.lang.Class<T>).
      Returns:
      Result<Boolean>
    • voidToBooleanParser

      public static ResponseParser<Boolean> voidToBooleanParser()
      Get a custom parser to convert Result<Void> response as to a Result<Void>. The result contains true if status code is 200.
      Returns:
      Result<Boolean>
    • voidToBooleanParser

      public static ResponseParser<Boolean> voidToBooleanParser(int... allowCodes)
      Get a custom parser to convert Result<Void> response as to a Result<Void>. The result contains true if status code is 200.
      Parameters:
      allowCodes - Avoid treating these error codes as an error and only return false.
      Returns:
      Result<Boolean>
    • arrayToListParser

      public static <T> ResponseParser<List<T>> arrayToListParser(Class<T[]> cls)
    • arrayToListParser

      public static <T, R> ResponseParser<List<R>> arrayToListParser(Class<T[]> cls, Function<? super T,? extends R> mapper)
    • getResult

      public T getResult()
    • getError

      public WeaviateError getError()
    • toString

      public String toString()
      Overrides:
      toString in class Object