Add string checks to VOs
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
43956ff10c
commit
d091772002
|
@ -7,9 +7,8 @@ public class Main {
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[]args){
|
public static void main(String[]args){
|
||||||
|
TagName test = new TagName("ds");
|
||||||
TagName a = new TagName("ds");
|
System.out.println(test);
|
||||||
System.out.println("Schnauze");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package link;
|
package link;
|
||||||
|
|
||||||
import category.CategoryId;
|
import category.CategoryId;
|
||||||
import tag.TagMatcher;
|
import tag.Tag;
|
||||||
import user.Username;
|
import user.Username;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -12,9 +12,9 @@ public class Link {
|
||||||
private final Username creator;
|
private final Username creator;
|
||||||
private final LinkUrl url;
|
private final LinkUrl url;
|
||||||
private final Set<CategoryId> categoryIds;
|
private final Set<CategoryId> categoryIds;
|
||||||
private final Set<TagMatcher> tags;
|
private final Set<Tag> tags;
|
||||||
|
|
||||||
public Link(LinkId id, Username creator, LinkUrl url, Set<CategoryId> categoryIds, Set<TagMatcher> tags) {
|
public Link(LinkId id, Username creator, LinkUrl url, Set<CategoryId> categoryIds, Set<Tag> tags) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.creator = creator;
|
this.creator = creator;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
package tag;
|
package tag;
|
||||||
|
|
||||||
|
import exeptions.IllegalValueObjectArgument;
|
||||||
|
|
||||||
public record TagName(String name) {
|
public record TagName(String name) {
|
||||||
|
|
||||||
|
public TagName {
|
||||||
|
if (name.isEmpty() || name.isBlank()) {
|
||||||
|
throw new IllegalValueObjectArgument("A Tag name must be a valid non-empty string.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
package user;
|
package user;
|
||||||
|
|
||||||
|
import exeptions.IllegalValueObjectArgument;
|
||||||
|
|
||||||
public record Username(String username) {
|
public record Username(String username) {
|
||||||
//TODO: checks if username is valid
|
|
||||||
|
public Username {
|
||||||
|
if (username.isBlank() || username.isEmpty()) {
|
||||||
|
throw new IllegalValueObjectArgument("A username must be a valid non-empty string.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue