きっかけは try! Swift 2016 の HIPSTER SWIFT でした。そこで Hector さんの lazy var について興味深い(当時はどんなに頑張っても意味を汲み取れなかった)話を受け、もう一度 lazy var の特徴を眺めそこから『Hector さんの発していた意味』と『lazy var をどんな風に使ったらいいのかな』みたいなことを考察してみた資料です。
37. ドメイン層
Offer.java
public class Offer {
OfferIdentifier id = new OfferIdentifier();
OfferTitle title = new OfferTitle();
Description description = new Description();
Features features = new Features();
EmploymentType employmentType = new EmploymentType();
Location location = new Location();
Holiday holiday = new Holiday();
AnnualSalaryRange annualSalaryRange = new AnnualSalaryRange();
CompanySummary company = new CompanySummary();
...
}
Offer アグリゲートのルート
37
初期化
38. ドメイン層
OfferRepository.java
public interface OfferRepository {
Offer findBy(OfferIdentifier id);
OfferSummaries listOfOfferSummary(Criteria criteria);
}
public class OfferSummaries {
int totalCount;
List<OfferSummary> values;
…
}
public class OfferSummary {
OfferIdentifier identifier = new OfferIdentifier();
OfferTitle title = new OfferTitle();
Description description = new Description();
Location location = new Location();
}
求人一覧用の要約オブジェクト
OfferSummaries.java
求人一覧(ファーストクラスコレクション)
OfferSummary.java
38