Advertisement
mgogo4

Untitled

Oct 20th, 2019
508
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. Mój FolderDto
  2. public class FolderDto {
  3.     private int id;
  4.     private String path;
  5.  
  6.     public FolderDto(int id, String path) {
  7.         this.id = id;
  8.         this.path = path;
  9.     }
  10.  
  11.     public int getId() {
  12.         return id;
  13.     }
  14.  
  15.     public String getPath() {
  16.         return path;
  17.     }
  18. }
  19.  
  20. Mój Response
  21. public class FolderDtoListResponse {
  22.     private List<FolderDto> result = new ArrayList<>();
  23.  
  24.     public FolderDtoListResponse(List<FolderDto> result) {
  25.         this.result.addAll(result);
  26.     }
  27.  
  28.     public List<FolderDto> getResult() {
  29.         return result;
  30.     }
  31. }
  32.  
  33. Wykorzystanie w FolderController
  34.  
  35.     @RequestMapping(name = "/", method = GET)
  36.     public List<FolderDto> returnFoldersList() {
  37.         return new FolderDtoListResponse(service.getFoldersList());
  38.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement