All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.rosetta.jptdesignatedcity.model.FooElection Maven / Gradle / Ivy
package com.rosetta.jptdesignatedcity.model;
import com.rosetta.jptdesignatedcity.model.FooElection;
import com.rosetta.jptdesignatedcity.model.FooElection.FooElectionBuilder;
import com.rosetta.jptdesignatedcity.model.FooElection.FooElectionBuilderImpl;
import com.rosetta.jptdesignatedcity.model.FooElection.FooElectionImpl;
import com.rosetta.jptdesignatedcity.model.meta.FooElectionMeta;
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="FooElection", builder=FooElection.FooElectionBuilderImpl.class, version="test")
public interface FooElection extends RosettaModelObject {
FooElectionMeta metaData = new FooElectionMeta();
/*********************** Getter Methods ***********************/
/**
* The elective party.
*/
String getParty();
String getLocation();
String getOther();
/*********************** Build Methods ***********************/
FooElection build();
FooElection.FooElectionBuilder toBuilder();
static FooElection.FooElectionBuilder builder() {
return new FooElection.FooElectionBuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends FooElection> metaData() {
return metaData;
}
@Override
default Class extends FooElection> getType() {
return FooElection.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processor.processBasic(path.newSubPath("party"), String.class, getParty(), this);
processor.processBasic(path.newSubPath("location"), String.class, getLocation(), this);
processor.processBasic(path.newSubPath("other"), String.class, getOther(), this);
}
/*********************** Builder Interface ***********************/
interface FooElectionBuilder extends FooElection, RosettaModelObjectBuilder {
FooElection.FooElectionBuilder setParty(String party);
FooElection.FooElectionBuilder setLocation(String location);
FooElection.FooElectionBuilder setOther(String other);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processor.processBasic(path.newSubPath("party"), String.class, getParty(), this);
processor.processBasic(path.newSubPath("location"), String.class, getLocation(), this);
processor.processBasic(path.newSubPath("other"), String.class, getOther(), this);
}
FooElection.FooElectionBuilder prune();
}
/*********************** Immutable Implementation of FooElection ***********************/
class FooElectionImpl implements FooElection {
private final String party;
private final String location;
private final String other;
protected FooElectionImpl(FooElection.FooElectionBuilder builder) {
this.party = builder.getParty();
this.location = builder.getLocation();
this.other = builder.getOther();
}
@Override
@RosettaAttribute("party")
public String getParty() {
return party;
}
@Override
@RosettaAttribute("location")
public String getLocation() {
return location;
}
@Override
@RosettaAttribute("other")
public String getOther() {
return other;
}
@Override
public FooElection build() {
return this;
}
@Override
public FooElection.FooElectionBuilder toBuilder() {
FooElection.FooElectionBuilder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(FooElection.FooElectionBuilder builder) {
ofNullable(getParty()).ifPresent(builder::setParty);
ofNullable(getLocation()).ifPresent(builder::setLocation);
ofNullable(getOther()).ifPresent(builder::setOther);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
FooElection _that = getType().cast(o);
if (!Objects.equals(party, _that.getParty())) return false;
if (!Objects.equals(location, _that.getLocation())) return false;
if (!Objects.equals(other, _that.getOther())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (party != null ? party.hashCode() : 0);
_result = 31 * _result + (location != null ? location.hashCode() : 0);
_result = 31 * _result + (other != null ? other.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "FooElection {" +
"party=" + this.party + ", " +
"location=" + this.location + ", " +
"other=" + this.other +
'}';
}
}
/*********************** Builder Implementation of FooElection ***********************/
class FooElectionBuilderImpl implements FooElection.FooElectionBuilder {
protected String party;
protected String location;
protected String other;
public FooElectionBuilderImpl() {
}
@Override
@RosettaAttribute("party")
public String getParty() {
return party;
}
@Override
@RosettaAttribute("location")
public String getLocation() {
return location;
}
@Override
@RosettaAttribute("other")
public String getOther() {
return other;
}
@Override
@RosettaAttribute("party")
public FooElection.FooElectionBuilder setParty(String party) {
this.party = party==null?null:party;
return this;
}
@Override
@RosettaAttribute("location")
public FooElection.FooElectionBuilder setLocation(String location) {
this.location = location==null?null:location;
return this;
}
@Override
@RosettaAttribute("other")
public FooElection.FooElectionBuilder setOther(String other) {
this.other = other==null?null:other;
return this;
}
@Override
public FooElection build() {
return new FooElection.FooElectionImpl(this);
}
@Override
public FooElection.FooElectionBuilder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public FooElection.FooElectionBuilder prune() {
return this;
}
@Override
public boolean hasData() {
if (getParty()!=null) return true;
if (getLocation()!=null) return true;
if (getOther()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public FooElection.FooElectionBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
FooElection.FooElectionBuilder o = (FooElection.FooElectionBuilder) other;
merger.mergeBasic(getParty(), o.getParty(), this::setParty);
merger.mergeBasic(getLocation(), o.getLocation(), this::setLocation);
merger.mergeBasic(getOther(), o.getOther(), this::setOther);
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;
FooElection _that = getType().cast(o);
if (!Objects.equals(party, _that.getParty())) return false;
if (!Objects.equals(location, _that.getLocation())) return false;
if (!Objects.equals(other, _that.getOther())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (party != null ? party.hashCode() : 0);
_result = 31 * _result + (location != null ? location.hashCode() : 0);
_result = 31 * _result + (other != null ? other.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "FooElectionBuilder {" +
"party=" + this.party + ", " +
"location=" + this.location + ", " +
"other=" + this.other +
'}';
}
}
}