From b3ced8c4eb98a152076b3f0a05ba601bce7f8d2a Mon Sep 17 00:00:00 2001 From: Arindam Mondal Date: Thu, 18 Apr 2019 19:05:58 +0900 Subject: Fix sonar issue: implement builder Sonar link: https://sonar.onap.org/issues?projectUuids=AV8LJxI3uDqGnRl2bdaB&resolved=false&rules=squid%3AS00107 Issue-ID: PORTAL-559 Change-Id: I28c202e69f4856131b91918c41343ae6a5df3bbe Signed-off-by: arind.mondal --- .../onap/portalsdk/core/domain/support/Domain.java | 88 ++++++++++++++++++---- 1 file changed, 74 insertions(+), 14 deletions(-) (limited to 'ecomp-sdk/epsdk-domain/src/main/java/org/onap') diff --git a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Domain.java b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Domain.java index dcf4fd54..8dd51757 100644 --- a/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Domain.java +++ b/ecomp-sdk/epsdk-domain/src/main/java/org/onap/portalsdk/core/domain/support/Domain.java @@ -65,20 +65,80 @@ public class Domain { double newXafterColl; double YafterColl; - public Domain(String id, String name, double interContWd, double interContH, double domainToLayoutWd, - double domainToLayoutH, double domainToContH, int numOfRowsofContainer, int numOfColsofContainer) { - this.id = id; - this.name = name; - this.interContWd = interContWd; - this.interContH = interContH; - this.domainToLayoutWd = domainToLayoutWd; - this.domainToLayoutH = domainToLayoutH; - this.domainToContH = domainToContH; - this.numOfRowsofContainer = numOfRowsofContainer; - this.numOfColsofContainer = numOfColsofContainer; - } - - public Position getP() { + public static class DomainBuilder { + private String id; + private String name; + private double interContWd; + private double interContH; + private double domainToLayoutWd; + private double domainToLayoutH; + private double domainToContH; + private int numOfRowsofContainer; + private int numOfColsofContainer; + + public DomainBuilder setId(String id) { + this.id = id; + return this; + } + + public DomainBuilder setName(String name) { + this.name = name; + return this; + } + + public DomainBuilder setInterContWd(double interContWd) { + this.interContWd = interContWd; + return this; + } + + public DomainBuilder setInterContH(double interContH) { + this.interContH = interContH; + return this; + } + + public DomainBuilder setDomainToLayoutWd(double domainToLayoutWd) { + this.domainToLayoutWd = domainToLayoutWd; + return this; + } + + public DomainBuilder setDomainToLayoutH(double domainToLayoutH) { + this.domainToLayoutH = domainToLayoutH; + return this; + } + + public DomainBuilder setDomainToContH(double domainToContH) { + this.domainToContH = domainToContH; + return this; + } + + public DomainBuilder setNumOfRowsofContainer(int numOfRowsofContainer) { + this.numOfRowsofContainer = numOfRowsofContainer; + return this; + } + + public DomainBuilder setNumOfColsofContainer(int numOfColsofContainer) { + this.numOfColsofContainer = numOfColsofContainer; + return this; + } + + public Domain createDomain() { + return new Domain(this); + } + } + + public Domain(DomainBuilder domainBuilder) { + this.id = domainBuilder.id; + this.name = domainBuilder.name; + this.interContWd = domainBuilder.interContWd; + this.interContH = domainBuilder.interContH; + this.domainToLayoutWd = domainBuilder.domainToLayoutWd; + this.domainToLayoutH = domainBuilder.domainToLayoutH; + this.domainToContH = domainBuilder.domainToContH; + this.numOfRowsofContainer = domainBuilder.numOfRowsofContainer; + this.numOfColsofContainer = domainBuilder.numOfColsofContainer; + } + + public Position getP() { return p; } -- cgit 1.2.3-korg