com.rosetta.jptlegalagreement.model.RightsEvent Maven / Gradle / Ivy
package com.rosetta.jptlegalagreement.model;
import com.rosetta.jptlegalagreement.model.RightsEvent;
import com.rosetta.jptlegalagreement.model.RightsEvent.RightsEventBuilder;
import com.rosetta.jptlegalagreement.model.RightsEvent.RightsEventBuilderImpl;
import com.rosetta.jptlegalagreement.model.RightsEvent.RightsEventImpl;
import com.rosetta.jptlegalagreement.model.meta.RightsEventMeta;
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="RightsEvent", builder=RightsEvent.RightsEventBuilderImpl.class, version="test")
public interface RightsEvent extends RosettaModelObject {
RightsEventMeta metaData = new RightsEventMeta();
/*********************** Getter Methods ***********************/
Boolean getIncludeCoolingOffLanguage();
String getCustomElection();
/*********************** Build Methods ***********************/
RightsEvent build();
RightsEvent.RightsEventBuilder toBuilder();
static RightsEvent.RightsEventBuilder builder() {
return new RightsEvent.RightsEventBuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends RightsEvent> metaData() {
return metaData;
}
@Override
default Class extends RightsEvent> getType() {
return RightsEvent.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processor.processBasic(path.newSubPath("includeCoolingOffLanguage"), Boolean.class, getIncludeCoolingOffLanguage(), this);
processor.processBasic(path.newSubPath("customElection"), String.class, getCustomElection(), this);
}
/*********************** Builder Interface ***********************/
interface RightsEventBuilder extends RightsEvent, RosettaModelObjectBuilder {
RightsEvent.RightsEventBuilder setIncludeCoolingOffLanguage(Boolean includeCoolingOffLanguage);
RightsEvent.RightsEventBuilder setCustomElection(String customElection);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processor.processBasic(path.newSubPath("includeCoolingOffLanguage"), Boolean.class, getIncludeCoolingOffLanguage(), this);
processor.processBasic(path.newSubPath("customElection"), String.class, getCustomElection(), this);
}
RightsEvent.RightsEventBuilder prune();
}
/*********************** Immutable Implementation of RightsEvent ***********************/
class RightsEventImpl implements RightsEvent {
private final Boolean includeCoolingOffLanguage;
private final String customElection;
protected RightsEventImpl(RightsEvent.RightsEventBuilder builder) {
this.includeCoolingOffLanguage = builder.getIncludeCoolingOffLanguage();
this.customElection = builder.getCustomElection();
}
@Override
@RosettaAttribute("includeCoolingOffLanguage")
public Boolean getIncludeCoolingOffLanguage() {
return includeCoolingOffLanguage;
}
@Override
@RosettaAttribute("customElection")
public String getCustomElection() {
return customElection;
}
@Override
public RightsEvent build() {
return this;
}
@Override
public RightsEvent.RightsEventBuilder toBuilder() {
RightsEvent.RightsEventBuilder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(RightsEvent.RightsEventBuilder builder) {
ofNullable(getIncludeCoolingOffLanguage()).ifPresent(builder::setIncludeCoolingOffLanguage);
ofNullable(getCustomElection()).ifPresent(builder::setCustomElection);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
RightsEvent _that = getType().cast(o);
if (!Objects.equals(includeCoolingOffLanguage, _that.getIncludeCoolingOffLanguage())) return false;
if (!Objects.equals(customElection, _that.getCustomElection())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (includeCoolingOffLanguage != null ? includeCoolingOffLanguage.hashCode() : 0);
_result = 31 * _result + (customElection != null ? customElection.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "RightsEvent {" +
"includeCoolingOffLanguage=" + this.includeCoolingOffLanguage + ", " +
"customElection=" + this.customElection +
'}';
}
}
/*********************** Builder Implementation of RightsEvent ***********************/
class RightsEventBuilderImpl implements RightsEvent.RightsEventBuilder {
protected Boolean includeCoolingOffLanguage;
protected String customElection;
public RightsEventBuilderImpl() {
}
@Override
@RosettaAttribute("includeCoolingOffLanguage")
public Boolean getIncludeCoolingOffLanguage() {
return includeCoolingOffLanguage;
}
@Override
@RosettaAttribute("customElection")
public String getCustomElection() {
return customElection;
}
@Override
@RosettaAttribute("includeCoolingOffLanguage")
public RightsEvent.RightsEventBuilder setIncludeCoolingOffLanguage(Boolean includeCoolingOffLanguage) {
this.includeCoolingOffLanguage = includeCoolingOffLanguage==null?null:includeCoolingOffLanguage;
return this;
}
@Override
@RosettaAttribute("customElection")
public RightsEvent.RightsEventBuilder setCustomElection(String customElection) {
this.customElection = customElection==null?null:customElection;
return this;
}
@Override
public RightsEvent build() {
return new RightsEvent.RightsEventImpl(this);
}
@Override
public RightsEvent.RightsEventBuilder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public RightsEvent.RightsEventBuilder prune() {
return this;
}
@Override
public boolean hasData() {
if (getIncludeCoolingOffLanguage()!=null) return true;
if (getCustomElection()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public RightsEvent.RightsEventBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
RightsEvent.RightsEventBuilder o = (RightsEvent.RightsEventBuilder) other;
merger.mergeBasic(getIncludeCoolingOffLanguage(), o.getIncludeCoolingOffLanguage(), this::setIncludeCoolingOffLanguage);
merger.mergeBasic(getCustomElection(), o.getCustomElection(), this::setCustomElection);
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;
RightsEvent _that = getType().cast(o);
if (!Objects.equals(includeCoolingOffLanguage, _that.getIncludeCoolingOffLanguage())) return false;
if (!Objects.equals(customElection, _that.getCustomElection())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (includeCoolingOffLanguage != null ? includeCoolingOffLanguage.hashCode() : 0);
_result = 31 * _result + (customElection != null ? customElection.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "RightsEventBuilder {" +
"includeCoolingOffLanguage=" + this.includeCoolingOffLanguage + ", " +
"customElection=" + this.customElection +
'}';
}
}
}