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