Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. public class Response {
  2. private String status;
  3. private String body;
  4. private Map<String, String> headers;
  5.  
  6. private Response() {
  7. }
  8.  
  9. public String status() {
  10. return status;
  11. }
  12.  
  13. public Map<String, String> headers() {
  14. return headers;
  15. }
  16.  
  17. public String body() {
  18. return body;
  19. }
  20.  
  21. public static class Builder {
  22. private Response response;
  23. private String status;
  24. private String body;
  25. private Map<String, String> headers;
  26.  
  27. public Builder() {
  28. this.response = new Response();
  29. }
  30.  
  31. public Builder withStatus(String status) {
  32. this.status = status;
  33. return this;
  34. }
  35.  
  36. public Builder withBody(String body) {
  37. this.body = body;
  38. return this;
  39. }
  40.  
  41. public Builder withHeaders(Map<String, String> headers) {
  42. this.headers = headers;
  43. return this;
  44. }
  45.  
  46. public Response build() {
  47. response.status = this.status;
  48. response.headers = this.headers;
  49. response.body = this.body;
  50.  
  51. return response;
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement