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.jptelections.model.Election Maven / Gradle / Ivy
package com.rosetta.jptelections.model;
import com.rosetta.jptelections.model.Election;
import com.rosetta.jptelections.model.Election.ElectionBuilder;
import com.rosetta.jptelections.model.Election.ElectionBuilderImpl;
import com.rosetta.jptelections.model.Election.ElectionImpl;
import com.rosetta.jptelections.model.meta.ElectionMeta;
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="Election", builder=Election.ElectionBuilderImpl.class, version="test")
public interface Election extends RosettaModelObject {
ElectionMeta metaData = new ElectionMeta();
/*********************** Getter Methods ***********************/
String getName();
String getSometype();
String getSomevalue();
Boolean getAsPermitted();
/*********************** Build Methods ***********************/
Election build();
Election.ElectionBuilder toBuilder();
static Election.ElectionBuilder builder() {
return new Election.ElectionBuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends Election> metaData() {
return metaData;
}
@Override
default Class extends Election> getType() {
return Election.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processor.processBasic(path.newSubPath("name"), String.class, getName(), this);
processor.processBasic(path.newSubPath("sometype"), String.class, getSometype(), this);
processor.processBasic(path.newSubPath("somevalue"), String.class, getSomevalue(), this);
processor.processBasic(path.newSubPath("asPermitted"), Boolean.class, getAsPermitted(), this);
}
/*********************** Builder Interface ***********************/
interface ElectionBuilder extends Election, RosettaModelObjectBuilder {
Election.ElectionBuilder setName(String name);
Election.ElectionBuilder setSometype(String sometype);
Election.ElectionBuilder setSomevalue(String somevalue);
Election.ElectionBuilder setAsPermitted(Boolean asPermitted);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processor.processBasic(path.newSubPath("name"), String.class, getName(), this);
processor.processBasic(path.newSubPath("sometype"), String.class, getSometype(), this);
processor.processBasic(path.newSubPath("somevalue"), String.class, getSomevalue(), this);
processor.processBasic(path.newSubPath("asPermitted"), Boolean.class, getAsPermitted(), this);
}
Election.ElectionBuilder prune();
}
/*********************** Immutable Implementation of Election ***********************/
class ElectionImpl implements Election {
private final String name;
private final String sometype;
private final String somevalue;
private final Boolean asPermitted;
protected ElectionImpl(Election.ElectionBuilder builder) {
this.name = builder.getName();
this.sometype = builder.getSometype();
this.somevalue = builder.getSomevalue();
this.asPermitted = builder.getAsPermitted();
}
@Override
@RosettaAttribute("name")
public String getName() {
return name;
}
@Override
@RosettaAttribute("sometype")
public String getSometype() {
return sometype;
}
@Override
@RosettaAttribute("somevalue")
public String getSomevalue() {
return somevalue;
}
@Override
@RosettaAttribute("asPermitted")
public Boolean getAsPermitted() {
return asPermitted;
}
@Override
public Election build() {
return this;
}
@Override
public Election.ElectionBuilder toBuilder() {
Election.ElectionBuilder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(Election.ElectionBuilder builder) {
ofNullable(getName()).ifPresent(builder::setName);
ofNullable(getSometype()).ifPresent(builder::setSometype);
ofNullable(getSomevalue()).ifPresent(builder::setSomevalue);
ofNullable(getAsPermitted()).ifPresent(builder::setAsPermitted);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
Election _that = getType().cast(o);
if (!Objects.equals(name, _that.getName())) return false;
if (!Objects.equals(sometype, _that.getSometype())) return false;
if (!Objects.equals(somevalue, _that.getSomevalue())) return false;
if (!Objects.equals(asPermitted, _that.getAsPermitted())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (name != null ? name.hashCode() : 0);
_result = 31 * _result + (sometype != null ? sometype.hashCode() : 0);
_result = 31 * _result + (somevalue != null ? somevalue.hashCode() : 0);
_result = 31 * _result + (asPermitted != null ? asPermitted.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "Election {" +
"name=" + this.name + ", " +
"sometype=" + this.sometype + ", " +
"somevalue=" + this.somevalue + ", " +
"asPermitted=" + this.asPermitted +
'}';
}
}
/*********************** Builder Implementation of Election ***********************/
class ElectionBuilderImpl implements Election.ElectionBuilder {
protected String name;
protected String sometype;
protected String somevalue;
protected Boolean asPermitted;
public ElectionBuilderImpl() {
}
@Override
@RosettaAttribute("name")
public String getName() {
return name;
}
@Override
@RosettaAttribute("sometype")
public String getSometype() {
return sometype;
}
@Override
@RosettaAttribute("somevalue")
public String getSomevalue() {
return somevalue;
}
@Override
@RosettaAttribute("asPermitted")
public Boolean getAsPermitted() {
return asPermitted;
}
@Override
@RosettaAttribute("name")
public Election.ElectionBuilder setName(String name) {
this.name = name==null?null:name;
return this;
}
@Override
@RosettaAttribute("sometype")
public Election.ElectionBuilder setSometype(String sometype) {
this.sometype = sometype==null?null:sometype;
return this;
}
@Override
@RosettaAttribute("somevalue")
public Election.ElectionBuilder setSomevalue(String somevalue) {
this.somevalue = somevalue==null?null:somevalue;
return this;
}
@Override
@RosettaAttribute("asPermitted")
public Election.ElectionBuilder setAsPermitted(Boolean asPermitted) {
this.asPermitted = asPermitted==null?null:asPermitted;
return this;
}
@Override
public Election build() {
return new Election.ElectionImpl(this);
}
@Override
public Election.ElectionBuilder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public Election.ElectionBuilder prune() {
return this;
}
@Override
public boolean hasData() {
if (getName()!=null) return true;
if (getSometype()!=null) return true;
if (getSomevalue()!=null) return true;
if (getAsPermitted()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public Election.ElectionBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
Election.ElectionBuilder o = (Election.ElectionBuilder) other;
merger.mergeBasic(getName(), o.getName(), this::setName);
merger.mergeBasic(getSometype(), o.getSometype(), this::setSometype);
merger.mergeBasic(getSomevalue(), o.getSomevalue(), this::setSomevalue);
merger.mergeBasic(getAsPermitted(), o.getAsPermitted(), this::setAsPermitted);
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;
Election _that = getType().cast(o);
if (!Objects.equals(name, _that.getName())) return false;
if (!Objects.equals(sometype, _that.getSometype())) return false;
if (!Objects.equals(somevalue, _that.getSomevalue())) return false;
if (!Objects.equals(asPermitted, _that.getAsPermitted())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (name != null ? name.hashCode() : 0);
_result = 31 * _result + (sometype != null ? sometype.hashCode() : 0);
_result = 31 * _result + (somevalue != null ? somevalue.hashCode() : 0);
_result = 31 * _result + (asPermitted != null ? asPermitted.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "ElectionBuilder {" +
"name=" + this.name + ", " +
"sometype=" + this.sometype + ", " +
"somevalue=" + this.somevalue + ", " +
"asPermitted=" + this.asPermitted +
'}';
}
}
}