Changeset 14:00fed0125c78
Updated javadoc
author | unexist |
---|---|
date | Wed, 11 Aug 2021 13:58:48 +0200 |
parents | ab28bf1a0594 |
children | 762f9bfb3f23 |
files | src/main/java/dev/unexist/showcase/todo/domain/todo/DueDate.java src/main/java/dev/unexist/showcase/todo/domain/todo/Todo.java src/main/java/dev/unexist/showcase/todo/domain/todo/TodoBase.java src/main/java/dev/unexist/showcase/todo/domain/todo/TodoRepository.java src/main/java/dev/unexist/showcase/todo/domain/todo/TodoService.java src/main/java/dev/unexist/showcase/todo/infrastructure/serializer/DateSerializer.java |
diffstat | 6 files changed, 54 insertions(+), 66 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/dev/unexist/showcase/todo/domain/todo/DueDate.java Mon Aug 02 13:25:56 2021 +0200 +++ b/src/main/java/dev/unexist/showcase/todo/domain/todo/DueDate.java Wed Aug 11 13:58:48 2021 +0200 @@ -26,8 +26,7 @@ /** * Get start date * - * @return - * Start date + * @return Start date **/ public LocalDate getStart() { @@ -37,8 +36,7 @@ /** * Set start date * - * @param start - * Date to set + * @param start Date to set **/ public void setStart(LocalDate start) { @@ -48,8 +46,7 @@ /** * Get due date * - * @return - * Due date + * @return Due date **/ public LocalDate getDue() { @@ -59,8 +56,7 @@ /** * Set due date * - * @param due - * Date to set + * @param due Date to set **/ public void setDue(LocalDate due) {
--- a/src/main/java/dev/unexist/showcase/todo/domain/todo/Todo.java Mon Aug 02 13:25:56 2021 +0200 +++ b/src/main/java/dev/unexist/showcase/todo/domain/todo/Todo.java Wed Aug 11 13:58:48 2021 +0200 @@ -21,12 +21,10 @@ public Todo() { } - /** * Constructor * - * @param base - * Base entry + * @param base Base entry **/ public Todo(final TodoBase base) { @@ -36,8 +34,7 @@ /** * Update values from base * - * @param base - * Todo base class + * @param base Todo base class **/ public void update(final TodoBase base) { @@ -50,8 +47,7 @@ /** * Get id of entry * - * @return - * Id of the entry + * @return Id of the entry **/ public int getId() { @@ -61,8 +57,7 @@ /** * Set id of entry * - * @param id - * Id of the entry + * @param id Id of the entry **/ public void setId(int id) {
--- a/src/main/java/dev/unexist/showcase/todo/domain/todo/TodoBase.java Mon Aug 02 13:25:56 2021 +0200 +++ b/src/main/java/dev/unexist/showcase/todo/domain/todo/TodoBase.java Wed Aug 11 13:58:48 2021 +0200 @@ -13,6 +13,7 @@ import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; +import java.util.Objects; public class TodoBase { @@ -30,8 +31,7 @@ /** * Get title of the entry * - * @return - * Title of the entry + * @return Title of the entry **/ public String getTitle() { @@ -41,8 +41,7 @@ /** * Set title of the entry * - * @param title - * Title of the entry + * @param title Title of the entry **/ public void setTitle(String title) { @@ -52,8 +51,7 @@ /** * Get description of entry * - * @return - * Description of the entry + * @return Description of the entry **/ public String getDescription() { @@ -74,8 +72,7 @@ /** * Get done state of entry * - * @return - * Done state of the entry + * @return Done state of the entry **/ public Boolean getDone() { @@ -85,8 +82,7 @@ /** * Set done state of entry * - * @param done - * Done state of the entry + * @param done Done state of the entry **/ public void setDone(Boolean done) { @@ -96,8 +92,7 @@ /** * Get due state of the entry * - * @return - * Due state of the entry + * @return Due state of the entry **/ public DueDate getDueDate() { @@ -107,11 +102,12 @@ /** * Set due date of the entry * - * @param dueDate - * Due date of the entry + * @param dueDate Due date of the entry **/ public void setDueDate(DueDate dueDate) { + Objects.requireNonNull(dueDate, "DueDate cannot be null"); + this.dueDate = dueDate; if (null != dueDate.getStart() && null != dueDate.getDue()) {
--- a/src/main/java/dev/unexist/showcase/todo/domain/todo/TodoRepository.java Mon Aug 02 13:25:56 2021 +0200 +++ b/src/main/java/dev/unexist/showcase/todo/domain/todo/TodoRepository.java Wed Aug 11 13:58:48 2021 +0200 @@ -19,10 +19,9 @@ /** * Add {@link Todo} entry to list * - * @param todo - * {@link Todo} entry to add - * @return - * Either {@code true} on success; otherwise {@code false} + * @param todo {@link Todo} entry to add + * + * @return Either {@code true} on success; otherwise {@code false} **/ boolean add(Todo todo); @@ -30,10 +29,9 @@ /** * Update {@link Todo} with given id * - * @param todo - * A {@link Todo} to update - * @return - * Either {@code true} on success; otherwise {@code false} + * @param todo A {@link Todo} to update + * + * @return Either {@code true} on success; otherwise {@code false} **/ boolean update(Todo todo); @@ -41,10 +39,9 @@ /** * Delete {@link Todo} with given id * - * @param id - * Id to delete - * @return - * Either {@code true} on success; otherwise {@code false} + * @param id Id to delete + * + * @return Either {@code true} on success; otherwise {@code false} **/ boolean deleteById(int id); @@ -60,10 +57,9 @@ /** * Find {@link Todo} by given id * - * @param id - * Id to find - * @return - * A {@link Optional} with the result of the lookup + * @param id Id to find + * + * @return A {@link Optional} with the result of the lookup **/ Optional<Todo> findById(int id);
--- a/src/main/java/dev/unexist/showcase/todo/domain/todo/TodoService.java Mon Aug 02 13:25:56 2021 +0200 +++ b/src/main/java/dev/unexist/showcase/todo/domain/todo/TodoService.java Wed Aug 11 13:58:48 2021 +0200 @@ -25,8 +25,8 @@ /** * Create new {@link Todo} entry and store it in repository * - * @param base - * A {@link TodoBase} entry + * @param base A {@link TodoBase} entry + * * @return **/ @@ -39,12 +39,10 @@ /** * Update {@link Todo} at with given id * - * @param id - * Id to update - * @param base - * Values for the entry - * @return - * Either {@code true} on success; otherwise {@code false} + * @param id Id to update + * @param base Values for the entry + * + * @return Either {@code true} on success; otherwise {@code false} **/ public boolean update(int id, TodoBase base) { @@ -63,10 +61,9 @@ /** * Delete {@link Todo} with given id * - * @param id - * Id to delete - * @return - * Either {@code true} on success; otherwise {@code false} + * @param id Id to delete + * + * @return Either {@code true} on success; otherwise {@code false} **/ public boolean delete(int id) { @@ -76,8 +73,7 @@ /** * Get all {@link Todo} entries * - * @return - * List of all {@link Todo}; might be empty + * @return List of all {@link Todo}; might be empty **/ public List<Todo> getAll() { @@ -87,10 +83,9 @@ /** * Find {@link Todo} by given id * - * @param id - * Id to look for - * @return - * A {@link Optional} of the entry + * @param id Id to look for + * + * @return A {@link Optional} of the entry **/ public Optional<Todo> findById(int id) {
--- a/src/main/java/dev/unexist/showcase/todo/infrastructure/serializer/DateSerializer.java Mon Aug 02 13:25:56 2021 +0200 +++ b/src/main/java/dev/unexist/showcase/todo/infrastructure/serializer/DateSerializer.java Wed Aug 11 13:58:48 2021 +0200 @@ -20,10 +20,20 @@ import java.time.format.DateTimeFormatter; public class DateSerializer extends JsonSerializer<LocalDate> { + public static final String PATTERN = "yyyy-MM-dd"; + + /** + * Serialize {@link LocalDate} to format + * + * @param value Value to convert + * @param gen A {@link JsonGenerator} + * @param serializers A {@link SerializerProvider} + * @throws IOException + **/ @Override public void serialize(LocalDate value, JsonGenerator gen, SerializerProvider serializers) throws IOException { - gen.writeString(value.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); + gen.writeString(value.format(DateTimeFormatter.ofPattern(PATTERN))); } }