com.rosetta.jptchargorposting.model.TopChargor Maven / Gradle / Ivy
package com.rosetta.jptchargorposting.model;
import com.rosetta.jptchargorposting.model.ChargorPostingObligations;
import com.rosetta.jptchargorposting.model.TopChargor;
import com.rosetta.jptchargorposting.model.TopChargor.TopChargorBuilder;
import com.rosetta.jptchargorposting.model.TopChargor.TopChargorBuilderImpl;
import com.rosetta.jptchargorposting.model.TopChargor.TopChargorImpl;
import com.rosetta.jptchargorposting.model.meta.TopChargorMeta;
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="TopChargor", builder=TopChargor.TopChargorBuilderImpl.class, version="test")
public interface TopChargor extends RosettaModelObject {
TopChargorMeta metaData = new TopChargorMeta();
/*********************** Getter Methods ***********************/
ChargorPostingObligations getChargorPostingObligations();
/*********************** Build Methods ***********************/
TopChargor build();
TopChargor.TopChargorBuilder toBuilder();
static TopChargor.TopChargorBuilder builder() {
return new TopChargor.TopChargorBuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends TopChargor> metaData() {
return metaData;
}
@Override
default Class extends TopChargor> getType() {
return TopChargor.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processRosetta(path.newSubPath("chargorPostingObligations"), processor, ChargorPostingObligations.class, getChargorPostingObligations());
}
/*********************** Builder Interface ***********************/
interface TopChargorBuilder extends TopChargor, RosettaModelObjectBuilder {
ChargorPostingObligations.ChargorPostingObligationsBuilder getOrCreateChargorPostingObligations();
ChargorPostingObligations.ChargorPostingObligationsBuilder getChargorPostingObligations();
TopChargor.TopChargorBuilder setChargorPostingObligations(ChargorPostingObligations chargorPostingObligations);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processRosetta(path.newSubPath("chargorPostingObligations"), processor, ChargorPostingObligations.ChargorPostingObligationsBuilder.class, getChargorPostingObligations());
}
TopChargor.TopChargorBuilder prune();
}
/*********************** Immutable Implementation of TopChargor ***********************/
class TopChargorImpl implements TopChargor {
private final ChargorPostingObligations chargorPostingObligations;
protected TopChargorImpl(TopChargor.TopChargorBuilder builder) {
this.chargorPostingObligations = ofNullable(builder.getChargorPostingObligations()).map(f->f.build()).orElse(null);
}
@Override
@RosettaAttribute("chargorPostingObligations")
public ChargorPostingObligations getChargorPostingObligations() {
return chargorPostingObligations;
}
@Override
public TopChargor build() {
return this;
}
@Override
public TopChargor.TopChargorBuilder toBuilder() {
TopChargor.TopChargorBuilder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(TopChargor.TopChargorBuilder builder) {
ofNullable(getChargorPostingObligations()).ifPresent(builder::setChargorPostingObligations);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
TopChargor _that = getType().cast(o);
if (!Objects.equals(chargorPostingObligations, _that.getChargorPostingObligations())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (chargorPostingObligations != null ? chargorPostingObligations.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "TopChargor {" +
"chargorPostingObligations=" + this.chargorPostingObligations +
'}';
}
}
/*********************** Builder Implementation of TopChargor ***********************/
class TopChargorBuilderImpl implements TopChargor.TopChargorBuilder {
protected ChargorPostingObligations.ChargorPostingObligationsBuilder chargorPostingObligations;
public TopChargorBuilderImpl() {
}
@Override
@RosettaAttribute("chargorPostingObligations")
public ChargorPostingObligations.ChargorPostingObligationsBuilder getChargorPostingObligations() {
return chargorPostingObligations;
}
@Override
public ChargorPostingObligations.ChargorPostingObligationsBuilder getOrCreateChargorPostingObligations() {
ChargorPostingObligations.ChargorPostingObligationsBuilder result;
if (chargorPostingObligations!=null) {
result = chargorPostingObligations;
}
else {
result = chargorPostingObligations = ChargorPostingObligations.builder();
}
return result;
}
@Override
@RosettaAttribute("chargorPostingObligations")
public TopChargor.TopChargorBuilder setChargorPostingObligations(ChargorPostingObligations chargorPostingObligations) {
this.chargorPostingObligations = chargorPostingObligations==null?null:chargorPostingObligations.toBuilder();
return this;
}
@Override
public TopChargor build() {
return new TopChargor.TopChargorImpl(this);
}
@Override
public TopChargor.TopChargorBuilder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public TopChargor.TopChargorBuilder prune() {
if (chargorPostingObligations!=null && !chargorPostingObligations.prune().hasData()) chargorPostingObligations = null;
return this;
}
@Override
public boolean hasData() {
if (getChargorPostingObligations()!=null && getChargorPostingObligations().hasData()) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public TopChargor.TopChargorBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
TopChargor.TopChargorBuilder o = (TopChargor.TopChargorBuilder) other;
merger.mergeRosetta(getChargorPostingObligations(), o.getChargorPostingObligations(), this::setChargorPostingObligations);
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;
TopChargor _that = getType().cast(o);
if (!Objects.equals(chargorPostingObligations, _that.getChargorPostingObligations())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (chargorPostingObligations != null ? chargorPostingObligations.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "TopChargorBuilder {" +
"chargorPostingObligations=" + this.chargorPostingObligations +
'}';
}
}
}