[java] dtoのデフォルト値設定について

public class testServiceDto { @ToString.Include private String id; @ToString.Include @NotNull private String name; }

上記のようなDtoをSonarQubeでコード診断行ったときに、「Add a constructor to the class, or provide default values,」という結果が返ってきました。

恐らくデフォルト値が設定されていないため発生しているかと思い下記のような修正を行ったのですが認識に問題はなかったでしょうか?

public class testServiceDto { @ToString.Include private String id; @ToString.Include @NotNull private String name; public testServiceDto() { this.id = null; this.name = "test"; } }

コメントを投稿

0 コメント