Class CodeResult<T>

java.lang.Object
cloud.opencode.base.basecode.CodeResult<T>
All Implemented Interfaces:
Serializable

public class CodeResult<T> extends Object implements Serializable
Author:
Jon url: Jon's blog url: OpenCode.cloud
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • data

      @Nullable private T data
    • code

      @Nullable private Integer code
    • message

      @Nullable private String message
    • status

      private org.springframework.http.HttpStatus status
    • total

      @Nullable private Long total
    • page

      @Nullable private Long page
    • pageSize

      @Nullable private Long pageSize
    • headers

      @Nullable private org.springframework.http.HttpHeaders headers
    • timestamp

      private long timestamp
    • mediaType

      @Nullable private org.springframework.http.MediaType mediaType
  • Constructor Details

    • CodeResult

      public CodeResult(@Nullable org.springframework.http.HttpStatus status)
    • CodeResult

      public CodeResult(@Nullable org.springframework.http.HttpStatus status, @Nullable T body)
    • CodeResult

      public CodeResult(@Nullable org.springframework.http.HttpStatus status, @Nullable T body, @Nullable String message, @Nullable Integer code)
    • CodeResult

      public CodeResult(@Nullable org.springframework.http.HttpStatus status, @Nullable T body, @Nullable org.springframework.http.MediaType type, @Nullable org.springframework.util.MultiValueMap<String,String> headers)
    • CodeResult

      public CodeResult(@Nullable org.springframework.http.HttpStatus status, @Nullable T body, @Nullable Long total, @Nullable Long page, @Nullable Long pageSize, @Nullable String message, @Nullable Integer code, @Nullable org.springframework.http.MediaType type, @Nullable org.springframework.util.MultiValueMap<String,String> headers)
  • Method Details

    • OK

      public static CodeResult OK()
      OK
      Returns:
    • OK

      public static <T> CodeResult OK(T data)
      OK
      Type Parameters:
      T -
      Parameters:
      data -
      Returns:
    • OK

      public static <T> CodeResult OK(T data, org.springframework.http.HttpStatus status)
      OK
      Type Parameters:
      T -
      Parameters:
      data - data
      status - HttpStatus
      Returns:
    • OK

      public static <T> CodeResult OK(T data, String message)
      OK
      Type Parameters:
      T -
      Parameters:
      data - data
      message - message
      Returns:
    • OK

      public static <T> CodeResult OK(T data, String message, org.springframework.http.HttpStatus status)
      OK
      Type Parameters:
      T -
      Parameters:
      data - data
      message - message
      status - HttpStatus
      Returns:
    • OK

      public static <T> CodeResult OK(T data, String message, Integer code)
      OK
      Type Parameters:
      T -
      Parameters:
      data - data
      message - message
      code - code
      Returns:
    • OK

      public static <T> CodeResult OK(T data, String message, Integer code, org.springframework.http.HttpStatus status)
      OK
      Type Parameters:
      T -
      Parameters:
      data - data
      message - message
      code - code
      status - HttpStatus
      Returns:
    • OK

      public static <T> CodeResult OK(T data, org.springframework.http.MediaType type)
      OK
      Type Parameters:
      T -
      Parameters:
      data - data
      type - MediaType
      Returns:
    • OK

      public static <T> CodeResult OK(T data, org.springframework.http.MediaType type, org.springframework.http.HttpStatus status)
      OK
      Type Parameters:
      T -
      Parameters:
      data - data
      type - MediaType
      status - HttpStatus
      Returns:
    • OK

      public static <T> CodeResult OK(T data, @Nullable org.springframework.http.MediaType type, @Nullable org.springframework.util.MultiValueMap<String,String> headers)
      OK
      Type Parameters:
      T -
      Parameters:
      data - data
      type - type
      headers - HttpHeaders
      Returns:
    • OK

      public static <T> CodeResult OK(T data, @Nullable org.springframework.http.MediaType type, @Nullable org.springframework.util.MultiValueMap<String,String> headers, org.springframework.http.HttpStatus status)
      OK
      Type Parameters:
      T -
      Parameters:
      data - data
      type - type
      headers - HttpHeaders
      status - HttpStatus
      Returns:
    • OK

      public static <T> CodeResult OK(T data, Long total, Long page, Long pageSize)
      OK
      Type Parameters:
      T -
      Parameters:
      data - data
      total - total
      page - page
      pageSize - pageSize
      Returns:
    • OK

      public static <T> CodeResult OK(T data, Long total, Long page, Long pageSize, String message, Integer code)
      OK
      Type Parameters:
      T -
      Parameters:
      data - data
      total - total
      page - page
      pageSize - pageSize
      message - message
      code - code
      Returns:
    • OK

      public static <T> CodeResult OK(T data, Long total, Long page, Long pageSize, String message, Integer code, @Nullable org.springframework.http.MediaType type, @Nullable org.springframework.util.MultiValueMap<String,String> headers)
      OK
      Type Parameters:
      T -
      Parameters:
      data - DATA
      total - total
      page - page
      pageSize - pageSize
      message - message
      code - code
      type - MediaType
      headers - HttpHeaders
      Returns:
    • OKWithMediaTypeAndHeaders

      public static <T> CodeResult OKWithMediaTypeAndHeaders(T data, @Nullable org.springframework.http.MediaType type, @Nullable org.springframework.util.MultiValueMap<String,String> headers, org.springframework.http.HttpStatus status)
      OKWithMediaTypeAndHeaders
      Type Parameters:
      T -
      Parameters:
      data - data
      type - MediaType
      headers - HttpHeaders
      status - HttpStatus
      Returns:
    • OKWithMediaTypeAndHeaders

      public static <T> CodeResult OKWithMediaTypeAndHeaders(T data, @Nullable org.springframework.http.MediaType type, @Nullable org.springframework.util.MultiValueMap<String,String> headers)
      OKWithMediaTypeAndHeaders
      Type Parameters:
      T -
      Parameters:
      data - data
      type - MediaType
      headers - HttpHeaders
      Returns:
    • OKOnlyStatus

      public static <T> CodeResult OKOnlyStatus(org.springframework.http.HttpStatus status)
      OK
      Type Parameters:
      T -
      Parameters:
      status - HttpStatus
      Returns:
    • OKWithoutStatus

      public static <T> CodeResult OKWithoutStatus(T data)
      OK
      Type Parameters:
      T -
      Parameters:
      data -
      Returns:
    • ERROR

      public static CodeResult ERROR()
      ERROR
      Returns:
    • ERROR

      public static CodeResult ERROR(String message)
      ERROR
      Parameters:
      message - message
      Returns:
    • ERROR

      public static CodeResult ERROR(org.springframework.http.HttpStatus status, String message)
      ERROR
      Parameters:
      status - HttpStatus
      message - message
      Returns:
    • ERROR

      public static CodeResult ERROR(org.springframework.http.HttpStatus status, String message, Integer code)
      ERROR
      Parameters:
      status - HttpStatus
      message - message
      code - code
      Returns:
    • ERROR

      public static CodeResult ERROR(org.springframework.http.HttpStatus status, @Nullable org.springframework.http.MediaType type, @Nullable org.springframework.util.MultiValueMap<String,String> headers)
      ERROR
      Parameters:
      status - HttpStatus
      type - MediaType
      headers - HttpHeaders
      Returns: