com.rosetta.teststruct.model.Period_10 Maven / Gradle / Ivy
package com.rosetta.teststruct.model;
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 com.rosetta.teststruct.model.Period_10;
import com.rosetta.teststruct.model.Period_10.Period_10Builder;
import com.rosetta.teststruct.model.Period_10.Period_10BuilderImpl;
import com.rosetta.teststruct.model.Period_10.Period_10Impl;
import com.rosetta.teststruct.model.meta.Period_10Meta;
import java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="Period_10", builder=Period_10.Period_10BuilderImpl.class, version="test")
public interface Period_10 extends RosettaModelObject {
Period_10Meta metaData = new Period_10Meta();
/*********************** Getter Methods ***********************/
Integer getPeriodMultiplier();
String getPeriod();
/*********************** Build Methods ***********************/
Period_10 build();
Period_10.Period_10Builder toBuilder();
static Period_10.Period_10Builder builder() {
return new Period_10.Period_10BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends Period_10> metaData() {
return metaData;
}
@Override
default Class extends Period_10> getType() {
return Period_10.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processor.processBasic(path.newSubPath("periodMultiplier"), Integer.class, getPeriodMultiplier(), this);
processor.processBasic(path.newSubPath("period"), String.class, getPeriod(), this);
}
/*********************** Builder Interface ***********************/
interface Period_10Builder extends Period_10, RosettaModelObjectBuilder {
Period_10.Period_10Builder setPeriodMultiplier(Integer periodMultiplier);
Period_10.Period_10Builder setPeriod(String period);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processor.processBasic(path.newSubPath("periodMultiplier"), Integer.class, getPeriodMultiplier(), this);
processor.processBasic(path.newSubPath("period"), String.class, getPeriod(), this);
}
Period_10.Period_10Builder prune();
}
/*********************** Immutable Implementation of Period_10 ***********************/
class Period_10Impl implements Period_10 {
private final Integer periodMultiplier;
private final String period;
protected Period_10Impl(Period_10.Period_10Builder builder) {
this.periodMultiplier = builder.getPeriodMultiplier();
this.period = builder.getPeriod();
}
@Override
@RosettaAttribute("periodMultiplier")
public Integer getPeriodMultiplier() {
return periodMultiplier;
}
@Override
@RosettaAttribute("period")
public String getPeriod() {
return period;
}
@Override
public Period_10 build() {
return this;
}
@Override
public Period_10.Period_10Builder toBuilder() {
Period_10.Period_10Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(Period_10.Period_10Builder builder) {
ofNullable(getPeriodMultiplier()).ifPresent(builder::setPeriodMultiplier);
ofNullable(getPeriod()).ifPresent(builder::setPeriod);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
Period_10 _that = getType().cast(o);
if (!Objects.equals(periodMultiplier, _that.getPeriodMultiplier())) return false;
if (!Objects.equals(period, _that.getPeriod())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (periodMultiplier != null ? periodMultiplier.hashCode() : 0);
_result = 31 * _result + (period != null ? period.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "Period_10 {" +
"periodMultiplier=" + this.periodMultiplier + ", " +
"period=" + this.period +
'}';
}
}
/*********************** Builder Implementation of Period_10 ***********************/
class Period_10BuilderImpl implements Period_10.Period_10Builder {
protected Integer periodMultiplier;
protected String period;
public Period_10BuilderImpl() {
}
@Override
@RosettaAttribute("periodMultiplier")
public Integer getPeriodMultiplier() {
return periodMultiplier;
}
@Override
@RosettaAttribute("period")
public String getPeriod() {
return period;
}
@Override
@RosettaAttribute("periodMultiplier")
public Period_10.Period_10Builder setPeriodMultiplier(Integer periodMultiplier) {
this.periodMultiplier = periodMultiplier==null?null:periodMultiplier;
return this;
}
@Override
@RosettaAttribute("period")
public Period_10.Period_10Builder setPeriod(String period) {
this.period = period==null?null:period;
return this;
}
@Override
public Period_10 build() {
return new Period_10.Period_10Impl(this);
}
@Override
public Period_10.Period_10Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public Period_10.Period_10Builder prune() {
return this;
}
@Override
public boolean hasData() {
if (getPeriodMultiplier()!=null) return true;
if (getPeriod()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public Period_10.Period_10Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
Period_10.Period_10Builder o = (Period_10.Period_10Builder) other;
merger.mergeBasic(getPeriodMultiplier(), o.getPeriodMultiplier(), this::setPeriodMultiplier);
merger.mergeBasic(getPeriod(), o.getPeriod(), this::setPeriod);
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;
Period_10 _that = getType().cast(o);
if (!Objects.equals(periodMultiplier, _that.getPeriodMultiplier())) return false;
if (!Objects.equals(period, _that.getPeriod())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (periodMultiplier != null ? periodMultiplier.hashCode() : 0);
_result = 31 * _result + (period != null ? period.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "Period_10Builder {" +
"periodMultiplier=" + this.periodMultiplier + ", " +
"period=" + this.period +
'}';
}
}
}