From 4b2a5b8b09b02de9e855a1e5e9a75101d6c334bc Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Fri, 17 Jun 2022 22:26:14 +0430 Subject: added comments --- src/main/java/com/terminaldweller/doc/Doc.java | 1 + src/main/java/com/terminaldweller/doc/DocService.java | 8 ++++++++ 2 files changed, 9 insertions(+) (limited to 'src/main/java/com/terminaldweller/doc') diff --git a/src/main/java/com/terminaldweller/doc/Doc.java b/src/main/java/com/terminaldweller/doc/Doc.java index 80247eb..35ee5fd 100644 --- a/src/main/java/com/terminaldweller/doc/Doc.java +++ b/src/main/java/com/terminaldweller/doc/Doc.java @@ -25,6 +25,7 @@ public class Doc { * @param id the id given by the db. * @param name the name of the documment given by the user. * @param lastModified the date of the last modification in unix epoch. + * @param body the actual text of the document. */ public Doc(Long id, String name, long lastModified, String body) { this.id = id; diff --git a/src/main/java/com/terminaldweller/doc/DocService.java b/src/main/java/com/terminaldweller/doc/DocService.java index df4456e..a885b9a 100644 --- a/src/main/java/com/terminaldweller/doc/DocService.java +++ b/src/main/java/com/terminaldweller/doc/DocService.java @@ -14,6 +14,12 @@ public class DocService { this.docRepository = docRepository; } + /** + * get a document by its id. + * + * @param id of the document to get. + * @return returns the found doc if any. + */ public Optional getDocs(Long id) { Optional docOptional = docRepository.findById(id); if (docOptional.isPresent()) { @@ -26,6 +32,7 @@ public class DocService { * Adds a new Document to the data store. * * @param doc the new Document to add. + * @param id the id of the document that's going to be created. */ public void addNewDoc(Long id, Doc doc) { // Optional docOptional = docRepository.findDocByName(doc.getName()); @@ -41,6 +48,7 @@ public class DocService { * Update a Document. * * @param doc the document to update. + * @param id the id of the document to be updated. */ public void updateDoc(Doc doc, Long id) { Optional docOptional = docRepository.findById(id); -- cgit v1.2.3