com.rosetta.jptlegalagreement.model.PartyContactInformation Maven / Gradle / Ivy
package com.rosetta.jptlegalagreement.model;
import com.rosetta.jptlegalagreement.model.PartyContactInformation;
import com.rosetta.jptlegalagreement.model.PartyContactInformation.PartyContactInformationBuilder;
import com.rosetta.jptlegalagreement.model.PartyContactInformation.PartyContactInformationBuilderImpl;
import com.rosetta.jptlegalagreement.model.PartyContactInformation.PartyContactInformationImpl;
import com.rosetta.jptlegalagreement.model.meta.PartyContactInformationMeta;
import com.rosetta.model.lib.RosettaModelObject;
import com.rosetta.model.lib.RosettaModelObjectBuilder;
import com.rosetta.model.lib.annotations.RosettaAttribute;
import com.rosetta.model.lib.annotations.RosettaDataType;
import com.rosetta.model.lib.meta.RosettaMetaData;
import com.rosetta.model.lib.path.RosettaPath;
import com.rosetta.model.lib.process.BuilderMerger;
import com.rosetta.model.lib.process.BuilderProcessor;
import com.rosetta.model.lib.process.Processor;
import java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="PartyContactInformation", builder=PartyContactInformation.PartyContactInformationBuilderImpl.class, version="test")
public interface PartyContactInformation extends RosettaModelObject {
PartyContactInformationMeta metaData = new PartyContactInformationMeta();
/*********************** Getter Methods ***********************/
/**
* The address specified as a string to support non-normalized contact information, such as in the case of ISDA Create.
*/
String getAddress();
/*********************** Build Methods ***********************/
PartyContactInformation build();
PartyContactInformation.PartyContactInformationBuilder toBuilder();
static PartyContactInformation.PartyContactInformationBuilder builder() {
return new PartyContactInformation.PartyContactInformationBuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends PartyContactInformation> metaData() {
return metaData;
}
@Override
default Class extends PartyContactInformation> getType() {
return PartyContactInformation.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processor.processBasic(path.newSubPath("address"), String.class, getAddress(), this);
}
/*********************** Builder Interface ***********************/
interface PartyContactInformationBuilder extends PartyContactInformation, RosettaModelObjectBuilder {
PartyContactInformation.PartyContactInformationBuilder setAddress(String address);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processor.processBasic(path.newSubPath("address"), String.class, getAddress(), this);
}
PartyContactInformation.PartyContactInformationBuilder prune();
}
/*********************** Immutable Implementation of PartyContactInformation ***********************/
class PartyContactInformationImpl implements PartyContactInformation {
private final String address;
protected PartyContactInformationImpl(PartyContactInformation.PartyContactInformationBuilder builder) {
this.address = builder.getAddress();
}
@Override
@RosettaAttribute("address")
public String getAddress() {
return address;
}
@Override
public PartyContactInformation build() {
return this;
}
@Override
public PartyContactInformation.PartyContactInformationBuilder toBuilder() {
PartyContactInformation.PartyContactInformationBuilder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(PartyContactInformation.PartyContactInformationBuilder builder) {
ofNullable(getAddress()).ifPresent(builder::setAddress);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
PartyContactInformation _that = getType().cast(o);
if (!Objects.equals(address, _that.getAddress())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (address != null ? address.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "PartyContactInformation {" +
"address=" + this.address +
'}';
}
}
/*********************** Builder Implementation of PartyContactInformation ***********************/
class PartyContactInformationBuilderImpl implements PartyContactInformation.PartyContactInformationBuilder {
protected String address;
public PartyContactInformationBuilderImpl() {
}
@Override
@RosettaAttribute("address")
public String getAddress() {
return address;
}
@Override
@RosettaAttribute("address")
public PartyContactInformation.PartyContactInformationBuilder setAddress(String address) {
this.address = address==null?null:address;
return this;
}
@Override
public PartyContactInformation build() {
return new PartyContactInformation.PartyContactInformationImpl(this);
}
@Override
public PartyContactInformation.PartyContactInformationBuilder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public PartyContactInformation.PartyContactInformationBuilder prune() {
return this;
}
@Override
public boolean hasData() {
if (getAddress()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public PartyContactInformation.PartyContactInformationBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
PartyContactInformation.PartyContactInformationBuilder o = (PartyContactInformation.PartyContactInformationBuilder) other;
merger.mergeBasic(getAddress(), o.getAddress(), this::setAddress);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
PartyContactInformation _that = getType().cast(o);
if (!Objects.equals(address, _that.getAddress())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (address != null ? address.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "PartyContactInformationBuilder {" +
"address=" + this.address +
'}';
}
}
}