Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Code Block
public class CourseunitDto implements Serializable {

private String name; //setters and getters

private CourseunitDto() {}

public static class Builder {

   private CourseunitDto courseunitDto;

  Builder() {
     this.courseunitDto = new CourseunitDto();
  }
  public Builder name(String name) {

   if (name == null) {
      throw new IllegalArgumentException("Course should have a name");
   }

   this.courseunitDto.setName(name);
   return this;
 }

 public CourseunitDto build() {
   return this.courseunitDto; }
}
}

Tällöin dto-olio voidaan rakentaa seuraavasti.

Code Block
new CourseunitDto.Builder.name("test").build();

...