Package io.weaviate.client.base
Class Result<T>
java.lang.Object
io.weaviate.client.base.Result<T>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ResponseParser<List<T>>
arrayToListParser
(Class<T[]> cls) static <T,
R> ResponseParser<List<R>> arrayToListParser
(Class<T[]> cls, Function<? super T, ? extends R> mapper) getError()
boolean
<C> Result<C>
Copy the Result object with a null body, preserving only the status code and the error message.toString()
voidToBoolean
(Response<Void> response) ConvertResult<Void>
response to aResult<Boolean>
.voidToBoolean
(Response<Void> response, int... allowCodes) ConvertResult<Void>
response to aResult<Boolean>
.static ResponseParser<Boolean>
Get a custom parser to convertResult<Void>
response as to aResult<Void>
.static ResponseParser<Boolean>
voidToBooleanParser
(int... allowCodes) Get a custom parser to convertResult<Void>
response as to aResult<Void>
.
-
Constructor Details
-
Result
-
Result
-
Result
-
-
Method Details
-
hasErrors
public boolean hasErrors() -
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
ConvertResult<Void>
response to aResult<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, likeBaseClient.sendDeleteRequest(java.lang.String, java.lang.Object, java.lang.Class<T>)
.- Returns:
Result<Boolean>
-
voidToBoolean
ConvertResult<Void>
response to aResult<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, likeBaseClient.sendDeleteRequest(java.lang.String, java.lang.Object, java.lang.Class<T>)
.- Returns:
Result<Boolean>
-
voidToBooleanParser
Get a custom parser to convertResult<Void>
response as to aResult<Void>
. The result contains true if status code is 200.- Returns:
Result<Boolean>
-
voidToBooleanParser
Get a custom parser to convertResult<Void>
response as to aResult<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
-
arrayToListParser
public static <T,R> ResponseParser<List<R>> arrayToListParser(Class<T[]> cls, Function<? super T, ? extends R> mapper) -
getResult
-
getError
-
toString
-