com.rosetta.jptlegalagreement.model.SpecifiedSimmVersion Maven / Gradle / Ivy
package com.rosetta.jptlegalagreement.model;
import com.rosetta.jptlegalagreement.model.Party;
import com.rosetta.jptlegalagreement.model.SpecifiedSimmVersion;
import com.rosetta.jptlegalagreement.model.SpecifiedSimmVersion.SpecifiedSimmVersionBuilder;
import com.rosetta.jptlegalagreement.model.SpecifiedSimmVersion.SpecifiedSimmVersionBuilderImpl;
import com.rosetta.jptlegalagreement.model.SpecifiedSimmVersion.SpecifiedSimmVersionImpl;
import com.rosetta.jptlegalagreement.model.meta.SpecifiedSimmVersionMeta;
import com.rosetta.jptlegalagreement.model.metafields.ReferenceWithMetaParty;
import com.rosetta.jptlegalagreement.model.metafields.ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder;
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="SpecifiedSimmVersion", builder=SpecifiedSimmVersion.SpecifiedSimmVersionBuilderImpl.class, version="test")
public interface SpecifiedSimmVersion extends RosettaModelObject {
SpecifiedSimmVersionMeta metaData = new SpecifiedSimmVersionMeta();
/*********************** Getter Methods ***********************/
ReferenceWithMetaParty getParty();
String getSimmVersion();
/*********************** Build Methods ***********************/
SpecifiedSimmVersion build();
SpecifiedSimmVersion.SpecifiedSimmVersionBuilder toBuilder();
static SpecifiedSimmVersion.SpecifiedSimmVersionBuilder builder() {
return new SpecifiedSimmVersion.SpecifiedSimmVersionBuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends SpecifiedSimmVersion> metaData() {
return metaData;
}
@Override
default Class extends SpecifiedSimmVersion> getType() {
return SpecifiedSimmVersion.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processRosetta(path.newSubPath("party"), processor, ReferenceWithMetaParty.class, getParty());
processor.processBasic(path.newSubPath("simmVersion"), String.class, getSimmVersion(), this);
}
/*********************** Builder Interface ***********************/
interface SpecifiedSimmVersionBuilder extends SpecifiedSimmVersion, RosettaModelObjectBuilder {
ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder getOrCreateParty();
ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder getParty();
SpecifiedSimmVersion.SpecifiedSimmVersionBuilder setParty(ReferenceWithMetaParty party0);
SpecifiedSimmVersion.SpecifiedSimmVersionBuilder setPartyValue(Party party1);
SpecifiedSimmVersion.SpecifiedSimmVersionBuilder setSimmVersion(String simmVersion);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processRosetta(path.newSubPath("party"), processor, ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder.class, getParty());
processor.processBasic(path.newSubPath("simmVersion"), String.class, getSimmVersion(), this);
}
SpecifiedSimmVersion.SpecifiedSimmVersionBuilder prune();
}
/*********************** Immutable Implementation of SpecifiedSimmVersion ***********************/
class SpecifiedSimmVersionImpl implements SpecifiedSimmVersion {
private final ReferenceWithMetaParty party;
private final String simmVersion;
protected SpecifiedSimmVersionImpl(SpecifiedSimmVersion.SpecifiedSimmVersionBuilder builder) {
this.party = ofNullable(builder.getParty()).map(f->f.build()).orElse(null);
this.simmVersion = builder.getSimmVersion();
}
@Override
@RosettaAttribute("party")
public ReferenceWithMetaParty getParty() {
return party;
}
@Override
@RosettaAttribute("simmVersion")
public String getSimmVersion() {
return simmVersion;
}
@Override
public SpecifiedSimmVersion build() {
return this;
}
@Override
public SpecifiedSimmVersion.SpecifiedSimmVersionBuilder toBuilder() {
SpecifiedSimmVersion.SpecifiedSimmVersionBuilder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(SpecifiedSimmVersion.SpecifiedSimmVersionBuilder builder) {
ofNullable(getParty()).ifPresent(builder::setParty);
ofNullable(getSimmVersion()).ifPresent(builder::setSimmVersion);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
SpecifiedSimmVersion _that = getType().cast(o);
if (!Objects.equals(party, _that.getParty())) return false;
if (!Objects.equals(simmVersion, _that.getSimmVersion())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (party != null ? party.hashCode() : 0);
_result = 31 * _result + (simmVersion != null ? simmVersion.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "SpecifiedSimmVersion {" +
"party=" + this.party + ", " +
"simmVersion=" + this.simmVersion +
'}';
}
}
/*********************** Builder Implementation of SpecifiedSimmVersion ***********************/
class SpecifiedSimmVersionBuilderImpl implements SpecifiedSimmVersion.SpecifiedSimmVersionBuilder {
protected ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder party;
protected String simmVersion;
public SpecifiedSimmVersionBuilderImpl() {
}
@Override
@RosettaAttribute("party")
public ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder getParty() {
return party;
}
@Override
public ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder getOrCreateParty() {
ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder result;
if (party!=null) {
result = party;
}
else {
result = party = ReferenceWithMetaParty.builder();
}
return result;
}
@Override
@RosettaAttribute("simmVersion")
public String getSimmVersion() {
return simmVersion;
}
@Override
@RosettaAttribute("party")
public SpecifiedSimmVersion.SpecifiedSimmVersionBuilder setParty(ReferenceWithMetaParty party) {
this.party = party==null?null:party.toBuilder();
return this;
}
@Override
public SpecifiedSimmVersion.SpecifiedSimmVersionBuilder setPartyValue(Party party) {
this.getOrCreateParty().setValue(party);
return this;
}
@Override
@RosettaAttribute("simmVersion")
public SpecifiedSimmVersion.SpecifiedSimmVersionBuilder setSimmVersion(String simmVersion) {
this.simmVersion = simmVersion==null?null:simmVersion;
return this;
}
@Override
public SpecifiedSimmVersion build() {
return new SpecifiedSimmVersion.SpecifiedSimmVersionImpl(this);
}
@Override
public SpecifiedSimmVersion.SpecifiedSimmVersionBuilder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public SpecifiedSimmVersion.SpecifiedSimmVersionBuilder prune() {
if (party!=null && !party.prune().hasData()) party = null;
return this;
}
@Override
public boolean hasData() {
if (getParty()!=null && getParty().hasData()) return true;
if (getSimmVersion()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public SpecifiedSimmVersion.SpecifiedSimmVersionBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
SpecifiedSimmVersion.SpecifiedSimmVersionBuilder o = (SpecifiedSimmVersion.SpecifiedSimmVersionBuilder) other;
merger.mergeRosetta(getParty(), o.getParty(), this::setParty);
merger.mergeBasic(getSimmVersion(), o.getSimmVersion(), this::setSimmVersion);
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;
SpecifiedSimmVersion _that = getType().cast(o);
if (!Objects.equals(party, _that.getParty())) return false;
if (!Objects.equals(simmVersion, _that.getSimmVersion())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (party != null ? party.hashCode() : 0);
_result = 31 * _result + (simmVersion != null ? simmVersion.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "SpecifiedSimmVersionBuilder {" +
"party=" + this.party + ", " +
"simmVersion=" + this.simmVersion +
'}';
}
}
}