Class CommentCollection
- java.lang.Object
-
- de.ipk_gatersleben.bit.bi.isa4j.components.CommentCollection
-
public class CommentCollection extends java.lang.ObjectClass to wrap the functions to handle theComments of a component.
-
-
Constructor Summary
Constructors Constructor Description CommentCollection()
-
Method Summary
Modifier and Type Method Description voidadd(Comment comment)Adds a new Comment to the collection.java.util.List<Comment>getAll()Return the list ofCommentsjava.util.Optional<Comment>getByName(java.lang.String name)Try to find the Comment in the collection with the given name.voidset(java.util.List<Comment> comments)Deletes all saved comments and adds the ones from the passed list.java.lang.StringtoString()
-
-
-
Method Detail
-
add
public void add(Comment comment)
Adds a new Comment to the collection.- Parameters:
comment- Cannot be null, only one Comment per name allowed, otherwise aRedundantItemExceptionwill be thrown.
-
getByName
public java.util.Optional<Comment> getByName(java.lang.String name)
Try to find the Comment in the collection with the given name.
-
set
public void set(java.util.List<Comment> comments)
Deletes all saved comments and adds the ones from the passed list. List cannot contain nulls or multiple comments with the same name.- Parameters:
comments- theListofComments to set
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-