Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,99 +25,99 @@
*/
public class BookDtoBuilder {
/**
* Tracked value for <code>title</code>: the book title to set.
* Tracked value for <code>author</code>: the book author to set.
*/
private TrackedValue<String> title = unsetValue();
private TrackedValue<String> author = unsetValue();

/**
* Tracked value for <code>author</code>: the book author to set.
* Tracked value for <code>available</code>: true if available, false otherwise.
*/
private TrackedValue<String> author = unsetValue();
private TrackedValue<Boolean> available = unsetValue();

/**
* Tracked value for <code>isbn</code>: the ISBN to set.
* Tracked value for <code>category</code>: the category code to set.
*/
private TrackedValue<String> isbn = unsetValue();
private TrackedValue<Character> category = unsetValue();

/**
* Tracked value for <code>pages</code>: the page count to set.
* Tracked value for <code>discount</code>: the discount percentage to set.
*/
private TrackedValue<Integer> pages = unsetValue();
private TrackedValue<Float> discount = unsetValue();

/**
* Tracked value for <code>price</code>: the book price to set.
* Tracked value for <code>edition</code>: the edition number to set.
*/
private TrackedValue<Double> price = unsetValue();
private TrackedValue<Short> edition = unsetValue();

/**
* Tracked value for <code>exactPrice</code>: the exact book price to set.
*/
private TrackedValue<BigDecimal> exactPrice = unsetValue();

/**
* Tracked value for <code>available</code>: true if available, false otherwise.
* Tracked value for <code>genres</code>: the set of genres to set.
*/
private TrackedValue<Boolean> available = unsetValue();
private TrackedValue<Set<String>> genres = unsetValue();

/**
* Tracked value for <code>rating</code>: the book rating to set.
* Tracked value for <code>isbn</code>: the ISBN to set.
*/
private TrackedValue<Byte> rating = unsetValue();
private TrackedValue<String> isbn = unsetValue();

/**
* Tracked value for <code>edition</code>: the edition number to set.
* Tracked value for <code>lastUpdated</code>: the last update timestamp to set.
*/
private TrackedValue<Short> edition = unsetValue();
private TrackedValue<LocalDateTime> lastUpdated = unsetValue();

/**
* Tracked value for <code>salesCount</code>: the sales count to set.
* Tracked value for <code>metadata</code>: the metadata map to set.
*/
private TrackedValue<Long> salesCount = unsetValue();
private TrackedValue<Map<String, String>> metadata = unsetValue();

/**
* Tracked value for <code>discount</code>: the discount percentage to set.
* Tracked value for <code>pages</code>: the page count to set.
*/
private TrackedValue<Float> discount = unsetValue();
private TrackedValue<Integer> pages = unsetValue();

/**
* Tracked value for <code>category</code>: the category code to set.
* Tracked value for <code>price</code>: the book price to set.
*/
private TrackedValue<Character> category = unsetValue();
private TrackedValue<Double> price = unsetValue();

/**
* Tracked value for <code>publishDate</code>: the publication date to set.
*/
private TrackedValue<LocalDate> publishDate = unsetValue();

/**
* Tracked value for <code>lastUpdated</code>: the last update timestamp to set.
* Tracked value for <code>publisher</code>: the publisher to set.
*/
private TrackedValue<LocalDateTime> lastUpdated = unsetValue();
private TrackedValue<PersonDto> publisher = unsetValue();

/**
* Tracked value for <code>subtitle</code>: an Optional containing the subtitle to set.
* Tracked value for <code>rating</code>: the book rating to set.
*/
private TrackedValue<Optional<String>> subtitle = unsetValue();
private TrackedValue<Byte> rating = unsetValue();

/**
* Tracked value for <code>tags</code>: the list of tags to set.
* Tracked value for <code>salesCount</code>: the sales count to set.
*/
private TrackedValue<List<String>> tags = unsetValue();
private TrackedValue<Long> salesCount = unsetValue();

/**
* Tracked value for <code>genres</code>: the set of genres to set.
* Tracked value for <code>subtitle</code>: an Optional containing the subtitle to set.
*/
private TrackedValue<Set<String>> genres = unsetValue();
private TrackedValue<Optional<String>> subtitle = unsetValue();

/**
* Tracked value for <code>metadata</code>: the metadata map to set.
* Tracked value for <code>tags</code>: the list of tags to set.
*/
private TrackedValue<Map<String, String>> metadata = unsetValue();
private TrackedValue<List<String>> tags = unsetValue();

/**
* Tracked value for <code>publisher</code>: the publisher to set.
* Tracked value for <code>title</code>: the book title to set.
*/
private TrackedValue<PersonDto> publisher = unsetValue();
private TrackedValue<String> title = unsetValue();

/**
* Empty constructor of builder for {@code org.javahelpers.simple.builders.example.BookDto}.
Expand All @@ -131,9 +131,28 @@ public BookDtoBuilder() {
* @param instance object instance for initialisiation
*/
public BookDtoBuilder(BookDto instance) {
this.title = initialValue(instance.getTitle());
this.author = initialValue(instance.getAuthor());
this.available = initialValue(instance.isAvailable());
if (this.available.value() == null) {
throw new IllegalArgumentException("Cannot initialize builder from instance: field 'available' is marked as non-null but source object has null value");
}
this.category = initialValue(instance.getCategory());
if (this.category.value() == null) {
throw new IllegalArgumentException("Cannot initialize builder from instance: field 'category' is marked as non-null but source object has null value");
}
this.discount = initialValue(instance.getDiscount());
if (this.discount.value() == null) {
throw new IllegalArgumentException("Cannot initialize builder from instance: field 'discount' is marked as non-null but source object has null value");
}
this.edition = initialValue(instance.getEdition());
if (this.edition.value() == null) {
throw new IllegalArgumentException("Cannot initialize builder from instance: field 'edition' is marked as non-null but source object has null value");
}
this.exactPrice = initialValue(instance.getExactPrice());
this.genres = initialValue(instance.getGenres());
this.isbn = initialValue(instance.getIsbn());
this.lastUpdated = initialValue(instance.getLastUpdated());
this.metadata = initialValue(instance.getMetadata());
this.pages = initialValue(instance.getPages());
if (this.pages.value() == null) {
throw new IllegalArgumentException("Cannot initialize builder from instance: field 'pages' is marked as non-null but source object has null value");
Expand All @@ -142,38 +161,19 @@ public BookDtoBuilder(BookDto instance) {
if (this.price.value() == null) {
throw new IllegalArgumentException("Cannot initialize builder from instance: field 'price' is marked as non-null but source object has null value");
}
this.exactPrice = initialValue(instance.getExactPrice());
this.available = initialValue(instance.isAvailable());
if (this.available.value() == null) {
throw new IllegalArgumentException("Cannot initialize builder from instance: field 'available' is marked as non-null but source object has null value");
}
this.publishDate = initialValue(instance.getPublishDate());
this.publisher = initialValue(instance.getPublisher());
this.rating = initialValue(instance.getRating());
if (this.rating.value() == null) {
throw new IllegalArgumentException("Cannot initialize builder from instance: field 'rating' is marked as non-null but source object has null value");
}
this.edition = initialValue(instance.getEdition());
if (this.edition.value() == null) {
throw new IllegalArgumentException("Cannot initialize builder from instance: field 'edition' is marked as non-null but source object has null value");
}
this.salesCount = initialValue(instance.getSalesCount());
if (this.salesCount.value() == null) {
throw new IllegalArgumentException("Cannot initialize builder from instance: field 'salesCount' is marked as non-null but source object has null value");
}
this.discount = initialValue(instance.getDiscount());
if (this.discount.value() == null) {
throw new IllegalArgumentException("Cannot initialize builder from instance: field 'discount' is marked as non-null but source object has null value");
}
this.category = initialValue(instance.getCategory());
if (this.category.value() == null) {
throw new IllegalArgumentException("Cannot initialize builder from instance: field 'category' is marked as non-null but source object has null value");
}
this.publishDate = initialValue(instance.getPublishDate());
this.lastUpdated = initialValue(instance.getLastUpdated());
this.subtitle = initialValue(instance.getSubtitle());
this.tags = initialValue(instance.getTags());
this.genres = initialValue(instance.getGenres());
this.metadata = initialValue(instance.getMetadata());
this.publisher = initialValue(instance.getPublisher());
this.title = initialValue(instance.getTitle());
}

/**
Expand Down Expand Up @@ -437,50 +437,50 @@ BookDtoBuilder validateTitle() {
* Builds the configured DTO instance.
*/
public BookDto build() {
if (this.available.isSet() && this.available.value() == null) {
throw new IllegalStateException("Field 'available' is marked as non-null but null value was provided");
}
if (this.category.isSet() && this.category.value() == null) {
throw new IllegalStateException("Field 'category' is marked as non-null but null value was provided");
}
if (this.discount.isSet() && this.discount.value() == null) {
throw new IllegalStateException("Field 'discount' is marked as non-null but null value was provided");
}
if (this.edition.isSet() && this.edition.value() == null) {
throw new IllegalStateException("Field 'edition' is marked as non-null but null value was provided");
}
if (this.pages.isSet() && this.pages.value() == null) {
throw new IllegalStateException("Field 'pages' is marked as non-null but null value was provided");
}
if (this.price.isSet() && this.price.value() == null) {
throw new IllegalStateException("Field 'price' is marked as non-null but null value was provided");
}
if (this.available.isSet() && this.available.value() == null) {
throw new IllegalStateException("Field 'available' is marked as non-null but null value was provided");
}
if (this.rating.isSet() && this.rating.value() == null) {
throw new IllegalStateException("Field 'rating' is marked as non-null but null value was provided");
}
if (this.edition.isSet() && this.edition.value() == null) {
throw new IllegalStateException("Field 'edition' is marked as non-null but null value was provided");
}
if (this.salesCount.isSet() && this.salesCount.value() == null) {
throw new IllegalStateException("Field 'salesCount' is marked as non-null but null value was provided");
}
if (this.discount.isSet() && this.discount.value() == null) {
throw new IllegalStateException("Field 'discount' is marked as non-null but null value was provided");
}
if (this.category.isSet() && this.category.value() == null) {
throw new IllegalStateException("Field 'category' is marked as non-null but null value was provided");
}
BookDto result = new BookDto();
this.title.ifSet(result::setTitle);
this.author.ifSet(result::setAuthor);
this.available.ifSet(result::setAvailable);
this.category.ifSet(result::setCategory);
this.discount.ifSet(result::setDiscount);
this.edition.ifSet(result::setEdition);
this.exactPrice.ifSet(result::setExactPrice);
this.genres.ifSet(result::setGenres);
this.isbn.ifSet(result::setIsbn);
this.lastUpdated.ifSet(result::setLastUpdated);
this.metadata.ifSet(result::setMetadata);
this.pages.ifSet(result::setPages);
this.price.ifSet(result::setPrice);
this.exactPrice.ifSet(result::setExactPrice);
this.available.ifSet(result::setAvailable);
this.publishDate.ifSet(result::setPublishDate);
this.publisher.ifSet(result::setPublisher);
this.rating.ifSet(result::setRating);
this.edition.ifSet(result::setEdition);
this.salesCount.ifSet(result::setSalesCount);
this.discount.ifSet(result::setDiscount);
this.category.ifSet(result::setCategory);
this.publishDate.ifSet(result::setPublishDate);
this.lastUpdated.ifSet(result::setLastUpdated);
this.subtitle.ifSet(result::setSubtitle);
this.tags.ifSet(result::setTags);
this.genres.ifSet(result::setGenres);
this.metadata.ifSet(result::setMetadata);
this.publisher.ifSet(result::setPublisher);
this.title.ifSet(result::setTitle);
return result;
}

Expand All @@ -492,25 +492,25 @@ public BookDto build() {
@Override
public String toString() {
return new ToStringBuilder(this, BuilderToStringStyle.INSTANCE)
.append("title", this.title)
.append("author", this.author)
.append("available", this.available)
.append("category", this.category)
.append("discount", this.discount)
.append("edition", this.edition)
.append("exactPrice", this.exactPrice)
.append("genres", this.genres)
.append("isbn", this.isbn)
.append("lastUpdated", this.lastUpdated)
.append("metadata", this.metadata)
.append("pages", this.pages)
.append("price", this.price)
.append("exactPrice", this.exactPrice)
.append("available", this.available)
.append("publishDate", this.publishDate)
.append("publisher", this.publisher)
.append("rating", this.rating)
.append("edition", this.edition)
.append("salesCount", this.salesCount)
.append("discount", this.discount)
.append("category", this.category)
.append("publishDate", this.publishDate)
.append("lastUpdated", this.lastUpdated)
.append("subtitle", this.subtitle)
.append("tags", this.tags)
.append("genres", this.genres)
.append("metadata", this.metadata)
.append("publisher", this.publisher)
.append("title", this.title)
.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,24 @@ public class PersonDtoBuilder implements IBuilderBase<PersonDto> {
private TrackedValue<String> name = unsetValue();

/**
* Tracked value for <code>nickNames</code>: nickNames.
* Tracked value for <code>birthdate</code>: birthdate.
*/
private TrackedValue<List<String>> nickNames = unsetValue();
private TrackedValue<LocalDate> birthdate = unsetValue();

/**
* Tracked value for <code>nickNames2</code>: nickNames2.
* Tracked value for <code>mannschaft</code>: mannschaft.
*/
private TrackedValue<String[]> nickNames2 = unsetValue();
private TrackedValue<MannschaftDto> mannschaft = unsetValue();

/**
* Tracked value for <code>birthdate</code>: birthdate.
* Tracked value for <code>nickNames</code>: nickNames.
*/
private TrackedValue<LocalDate> birthdate = unsetValue();
private TrackedValue<List<String>> nickNames = unsetValue();

/**
* Tracked value for <code>mannschaft</code>: mannschaft.
* Tracked value for <code>nickNames2</code>: nickNames2.
*/
private TrackedValue<MannschaftDto> mannschaft = unsetValue();
private TrackedValue<String[]> nickNames2 = unsetValue();

/**
* Empty constructor of builder for {@code org.javahelpers.simple.builders.example.PersonDto}.
Expand All @@ -69,9 +69,9 @@ public PersonDtoBuilder() {
*/
public PersonDtoBuilder(PersonDto instance) {
this.name = initialValue(instance.getName());
this.nickNames = initialValue(instance.getNickNames());
this.birthdate = initialValue(instance.getBirthdate());
this.mannschaft = initialValue(instance.getMannschaft());
this.nickNames = initialValue(instance.getNickNames());
}

/**
Expand Down Expand Up @@ -347,10 +347,10 @@ public PersonDtoBuilder conditional(BooleanSupplier condition,
@Override
public PersonDto build() {
PersonDto result = new PersonDto(this.name.value());
this.nickNames.ifSet(result::setNickNames);
this.nickNames2.ifSet(result::setNickNames2);
this.birthdate.ifSet(result::setBirthdate);
this.mannschaft.ifSet(result::setMannschaft);
this.nickNames.ifSet(result::setNickNames);
this.nickNames2.ifSet(result::setNickNames2);
return result;
}

Expand All @@ -363,10 +363,10 @@ public PersonDto build() {
public String toString() {
return new ToStringBuilder(this, BuilderToStringStyle.INSTANCE)
.append("name", this.name)
.append("nickNames", this.nickNames)
.append("nickNames2", this.nickNames2)
.append("birthdate", this.birthdate)
.append("mannschaft", this.mannschaft)
.append("nickNames", this.nickNames)
.append("nickNames2", this.nickNames2)
.toString();
}

Expand Down
2 changes: 2 additions & 0 deletions processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@
<exclude>**/*Mapper*.class</exclude>
<!-- Exclude DTOs package from coverage -->
<exclude>**/processor/dtos/**</exclude>
<!-- Exclude exception classes from coverage (simple constructors) -->
<exclude>**/processor/exceptions/**</exclude>
</excludes>
</configuration>
</execution>
Expand Down
Loading
Loading