Package me.saro.commons.web
Class WebResult<T>
- java.lang.Object
-
- me.saro.commons.web.WebResult<T>
-
public class WebResult<T> extends java.lang.Objectweb result- Since:
- 0.1
- Author:
- PARK Yong Seo
-
-
Method Summary
Modifier and Type Method Description TgetBody()get response body dataTgetBody(T orElse)get response body dataTgetBodyWithThrow()get response body data throw null body<X extends java.lang.Throwable>
TgetBodyWithThrow(java.util.function.Supplier<? extends X> exceptionSupplier)get response body data throw null bodyjava.lang.StringgetErrorBody()get response error body datajava.lang.StringgetErrorBody(java.lang.String orElse)get response error body databooleanhasBody()has bodybooleanisStatus2xx()is status 2xxbooleanisStatus3xx()is status 3xxbooleanisStatus4xx()is status 4xxbooleanisStatus5xx()is status 5xxbooleanisSuccess()is status 2xx + have not exception
-
-
-
Method Detail
-
isSuccess
public boolean isSuccess()
is status 2xx + have not exception- Returns:
-
isStatus2xx
public boolean isStatus2xx()
is status 2xx- Returns:
-
isStatus3xx
public boolean isStatus3xx()
is status 3xx- Returns:
-
isStatus4xx
public boolean isStatus4xx()
is status 4xx- Returns:
-
isStatus5xx
public boolean isStatus5xx()
is status 5xx- Returns:
-
hasBody
public boolean hasBody()
has body- Returns:
-
getBody
public T getBody()
get response body data- Returns:
- Optional response body data
-
getBodyWithThrow
public <X extends java.lang.Throwable> T getBodyWithThrow(java.util.function.Supplier<? extends X> exceptionSupplier) throws X extends java.lang.Throwable
get response body data throw null body- Returns:
- Optional response body data
- Throws:
XX extends java.lang.Throwable
-
getBodyWithThrow
public T getBodyWithThrow() throws java.lang.NullPointerException
get response body data throw null body- Returns:
- Optional response body data
- Throws:
java.lang.NullPointerException
-
getErrorBody
public java.lang.String getErrorBody()
get response error body data- Returns:
- Optional response body data
-
getErrorBody
public java.lang.String getErrorBody(java.lang.String orElse)
get response error body data- Parameters:
orElse-- Returns:
-
-