Class ResponseHandler<T>

java.lang.Object
ch.bztf.m226blb1.Utils.ResponseHandler<T>
Type Parameters:
T - the body type

public class ResponseHandler<T> extends Object
Handler for the response of the REST API.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    ResponseHandler(String message, org.springframework.http.HttpStatus status)
    Constructor with the message and the status.
    ResponseHandler(T data, String message, org.springframework.http.HttpStatus status)
    Constructor for all fields.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.http.ResponseEntity<Object>
    Creates a response entity from the current class.
    static org.springframework.http.ResponseEntity<Object>
    generateResponse(Object responseObj, String message, org.springframework.http.HttpStatus status)
    Creates a response entity with a data, message and status.
    static org.springframework.http.ResponseEntity<Object>
    generateResponse(String message, org.springframework.http.HttpStatus status)
    Creates a response entity with a message and status.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ResponseHandler

      public ResponseHandler(String message, org.springframework.http.HttpStatus status)
      Constructor with the message and the status.
      Parameters:
      message - the message
      status - the status
    • ResponseHandler

      public ResponseHandler(T data, String message, org.springframework.http.HttpStatus status)
      Constructor for all fields.
      Parameters:
      data - the data of type <T>
      message - the message
      status - the status
  • Method Details

    • generateResponse

      public org.springframework.http.ResponseEntity<Object> generateResponse()
      Creates a response entity from the current class.
      Returns:
      a response entity with all fields.
      See Also:
    • generateResponse

      public static org.springframework.http.ResponseEntity<Object> generateResponse(String message, org.springframework.http.HttpStatus status)
      Creates a response entity with a message and status.
      Parameters:
      message - the message
      status - the status
      Returns:
      a response entity with all fields
      See Also:
    • generateResponse

      public static org.springframework.http.ResponseEntity<Object> generateResponse(Object responseObj, String message, org.springframework.http.HttpStatus status)
      Creates a response entity with a data, message and status.
      Parameters:
      responseObj - the data
      message - the message
      status - the status
      Returns:
      a response entity with all fields