This commit is contained in:
parent
d1fdad7cf9
commit
3ef31c9c3c
23 changed files with 228 additions and 27 deletions
|
@ -19,6 +19,11 @@ public class Category {
|
|||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name.toString();
|
||||
}
|
||||
|
||||
public CategoryId getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
|
@ -41,4 +41,9 @@ public class CategoryName {
|
|||
public int hashCode() {
|
||||
return name != null ? name.hashCode() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,15 @@ public class Link {
|
|||
return url.equals(link.url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return url +
|
||||
" created by =" + creator +
|
||||
", categoryIds=" + categoryIds +
|
||||
", tags=" + tags +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = id.hashCode();
|
||||
|
|
|
@ -7,13 +7,14 @@ import exeptions.LinkAlreadyExists;
|
|||
import exeptions.LinkDoesNotExist;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
public class LinkRepository {
|
||||
|
||||
final private CustomSet<Link> links;
|
||||
|
||||
public LinkRepository(PersistenceAdapter<Link> linkPersistenceAdapter) {
|
||||
this.links = new CustomSetPersistenceDecorator(linkPersistenceAdapter);
|
||||
this.links = new CustomSetPersistenceDecorator<>(linkPersistenceAdapter);
|
||||
}
|
||||
|
||||
public Optional<Link> getById(LinkId id) {
|
||||
|
@ -41,6 +42,10 @@ public class LinkRepository {
|
|||
links.add(link);
|
||||
}
|
||||
|
||||
public Set<Link> getAll() {
|
||||
return links.getSet();
|
||||
}
|
||||
|
||||
private void remove(Link link) {
|
||||
links.remove(link);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.Optional;
|
|||
public class Tag {
|
||||
|
||||
private TagName name;
|
||||
private Optional<String> additionalData;
|
||||
private Optional<String> additionalData = Optional.empty();
|
||||
|
||||
public Tag(TagName name) {
|
||||
this.name = name;
|
||||
|
@ -21,6 +21,11 @@ public class Tag {
|
|||
this.additionalData = additionalData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Tag: " + name + " " + additionalData.orElse("");
|
||||
}
|
||||
|
||||
public TagName getName() {
|
||||
return name;
|
||||
}
|
||||
|
|
|
@ -9,4 +9,9 @@ public record TagName(String name) {
|
|||
throw new IllegalValueObjectArgument("A Tag name must be a valid non-empty string.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,4 +9,9 @@ public record Username(String username) {
|
|||
throw new IllegalValueObjectArgument("A username must be a valid non-empty string.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return username;
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue