Skip to content
Snippets Groups Projects
Commit bc4481a0 authored by stendler's avatar stendler
Browse files

Basic RestController & model object

parent 55f7d03e
No related branches found
No related tags found
No related merge requests found
package de.fuberlin.imp.memorybox.restmembox.controller;
import de.fuberlin.imp.memorybox.restmembox.model.MemoryBox;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/memorybox")
public class MemoryBoxController {
private static final String REQUEST_PARAM_ID = "id";
public MemoryBox memoryBox(@RequestParam(value=REQUEST_PARAM_ID, defaultValue = "0") long id) {
return new MemoryBox(id);
}
}
package de.fuberlin.imp.memorybox.restmembox.model;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDate;
public class MemoryBox {
@Getter
private final long id;
@Getter
@Setter
private String name;
@Getter
private final LocalDate creationDate;
@Getter
@Setter
private String memory; // demo
/*
// for later - how this might look like
@Getter
@Setter
private MemoryBox memoryBox;
*/
public MemoryBox(long id) {
this.id = id;
this.creationDate = LocalDate.now();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment