builder pattern

This commit is contained in:
Claudio Atzori 2020-02-03 10:35:51 +01:00
parent 7ba0f44d05
commit ed290ca8d7
3 changed files with 22 additions and 14 deletions

View File

@ -12,16 +12,18 @@ public class Field<T> implements Serializable {
return value;
}
public void setValue(T value) {
public Field<T> setValue(T value) {
this.value = value;
return this;
}
public DataInfo getDataInfo() {
return dataInfo;
}
public void setDataInfo(DataInfo dataInfo) {
public Field<T> setDataInfo(DataInfo dataInfo) {
this.dataInfo = dataInfo;
return this;
}
@Override

View File

@ -26,68 +26,74 @@ public class Instance implements Serializable {
return license;
}
public void setLicense(Field<String> license) {
public Instance setLicense(Field<String> license) {
this.license = license;
return this;
}
public Qualifier getAccessright() {
return accessright;
}
public void setAccessright(Qualifier accessright) {
public Instance setAccessright(Qualifier accessright) {
this.accessright = accessright;
return this;
}
public Qualifier getInstancetype() {
return instancetype;
}
public void setInstancetype(Qualifier instancetype) {
public Instance setInstancetype(Qualifier instancetype) {
this.instancetype = instancetype;
return this;
}
public KeyValue getHostedby() {
return hostedby;
}
public void setHostedby(KeyValue hostedby) {
public Instance setHostedby(KeyValue hostedby) {
this.hostedby = hostedby;
return this;
}
public List<String> getUrl() {
return url;
}
public void setUrl(List<String> url) {
public Instance setUrl(List<String> url) {
this.url = url;
return this;
}
public String getDistributionlocation() {
return distributionlocation;
}
public void setDistributionlocation(String distributionlocation) {
public Instance setDistributionlocation(String distributionlocation) {
this.distributionlocation = distributionlocation;
return this;
}
public KeyValue getCollectedfrom() {
return collectedfrom;
}
public void setCollectedfrom(KeyValue collectedfrom) {
public Instance setCollectedfrom(KeyValue collectedfrom) {
this.collectedfrom = collectedfrom;
return this;
}
public Field<String> getDateofacceptance() {
return dateofacceptance;
}
public void setDateofacceptance(Field<String> dateofacceptance) {
public Instance setDateofacceptance(Field<String> dateofacceptance) {
this.dateofacceptance = dateofacceptance;
return this;
}
public String toComparableString(){
return String.format("%s::%s::%s::%s",
hostedby != null && hostedby.getKey()!= null ? hostedby.getKey().toLowerCase() : "",