Skip to content

Commit

Permalink
Add some more builder methods
Browse files Browse the repository at this point in the history
  • Loading branch information
morpheus-87 committed Sep 5, 2023
1 parent 1966dbd commit ec65420
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import de.digitalcollections.model.identifiable.entity.agent.Agent;
import de.digitalcollections.model.text.LocalizedStructuredContent;
import de.digitalcollections.model.text.StructuredContent;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import lombok.experimental.SuperBuilder;
import org.wikidata.wdtk.datamodel.interfaces.TimeValue;

Expand Down Expand Up @@ -70,5 +72,13 @@ public C build() {
c.init();
return c;
}

public B text(Locale locale, StructuredContent content) {
if (text == null) {
text = new LocalizedStructuredContent();
}
text.put(locale, content);
return self();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
import de.digitalcollections.model.identifiable.INode;
import de.digitalcollections.model.identifiable.Node;
import de.digitalcollections.model.text.LocalizedStructuredContent;
import de.digitalcollections.model.text.StructuredContent;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import lombok.experimental.SuperBuilder;

Expand Down Expand Up @@ -195,5 +197,13 @@ public B publicationStart(String publicationStart) {
this.publicationStart = LocalDate.parse(publicationStart);
return self();
}

public B text(Locale locale, StructuredContent content) {
if (text == null) {
text = new LocalizedStructuredContent();
}
text.put(locale, content);
return self();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package de.digitalcollections.model.identifiable.entity;

import de.digitalcollections.model.text.LocalizedStructuredContent;
import de.digitalcollections.model.text.StructuredContent;
import java.time.LocalDate;
import java.util.Locale;
import lombok.experimental.SuperBuilder;

/**
Expand Down Expand Up @@ -76,5 +78,13 @@ public C build() {
setInternalReferences(c);
return c;
}

public B text(Locale locale, StructuredContent content) {
if (text == null) {
text = new LocalizedStructuredContent();
}
text.put(locale, content);
return self();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,14 @@ public B homepageUrl(URL homepageUrl) {
return self();
}

public B text(Locale locale, StructuredContent content) {
if (text == null) {
text = new LocalizedStructuredContent();
}
text.put(locale, content);
return self();
}

public B text(Locale locale, String text) {
if (this.text == null) {
this.text = new LocalizedStructuredContent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
import de.digitalcollections.model.identifiable.Node;
import de.digitalcollections.model.text.LocalizedStructuredContent;
import de.digitalcollections.model.text.LocalizedText;
import de.digitalcollections.model.text.StructuredContent;
import de.digitalcollections.model.view.RenderingHints;
import java.time.LocalDate;
import java.util.List;
import java.util.Locale;
import lombok.experimental.SuperBuilder;

/** A Webpage of a Website. */
Expand Down Expand Up @@ -179,5 +181,13 @@ public B templateName(String templateName) {
renderingHints.setTemplateName(templateName);
return self();
}

public B text(Locale locale, StructuredContent content) {
if (text == null) {
text = new LocalizedStructuredContent();
}
text.put(locale, content);
return self();
}
}
}

0 comments on commit ec65420

Please sign in to comment.