com.rosetta.testconditional.model.W10_2 Maven / Gradle / Ivy
The newest version!
package com.rosetta.testconditional.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.testconditional.model.TestEnum;
import com.rosetta.testconditional.model.W10_2;
import com.rosetta.testconditional.model.W10_2.W10_2Builder;
import com.rosetta.testconditional.model.W10_2.W10_2BuilderImpl;
import com.rosetta.testconditional.model.W10_2.W10_2Impl;
import com.rosetta.testconditional.model.meta.W10_2Meta;
import java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="W10_2", builder=W10_2.W10_2BuilderImpl.class, version="test")
public interface W10_2 extends RosettaModelObject {
W10_2Meta metaData = new W10_2Meta();
/*********************** Getter Methods ***********************/
String getId();
TestEnum getRole();
/*********************** Build Methods ***********************/
W10_2 build();
W10_2.W10_2Builder toBuilder();
static W10_2.W10_2Builder builder() {
return new W10_2.W10_2BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends W10_2> metaData() {
return metaData;
}
@Override
default Class extends W10_2> getType() {
return W10_2.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processor.processBasic(path.newSubPath("id"), String.class, getId(), this);
processor.processBasic(path.newSubPath("role"), TestEnum.class, getRole(), this);
}
/*********************** Builder Interface ***********************/
interface W10_2Builder extends W10_2, RosettaModelObjectBuilder {
W10_2.W10_2Builder setId(String id);
W10_2.W10_2Builder setRole(TestEnum role);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processor.processBasic(path.newSubPath("id"), String.class, getId(), this);
processor.processBasic(path.newSubPath("role"), TestEnum.class, getRole(), this);
}
W10_2.W10_2Builder prune();
}
/*********************** Immutable Implementation of W10_2 ***********************/
class W10_2Impl implements W10_2 {
private final String id;
private final TestEnum role;
protected W10_2Impl(W10_2.W10_2Builder builder) {
this.id = builder.getId();
this.role = builder.getRole();
}
@Override
@RosettaAttribute("id")
public String getId() {
return id;
}
@Override
@RosettaAttribute("role")
public TestEnum getRole() {
return role;
}
@Override
public W10_2 build() {
return this;
}
@Override
public W10_2.W10_2Builder toBuilder() {
W10_2.W10_2Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(W10_2.W10_2Builder builder) {
ofNullable(getId()).ifPresent(builder::setId);
ofNullable(getRole()).ifPresent(builder::setRole);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
W10_2 _that = getType().cast(o);
if (!Objects.equals(id, _that.getId())) return false;
if (!Objects.equals(role, _that.getRole())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (id != null ? id.hashCode() : 0);
_result = 31 * _result + (role != null ? role.getClass().getName().hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "W10_2 {" +
"id=" + this.id + ", " +
"role=" + this.role +
'}';
}
}
/*********************** Builder Implementation of W10_2 ***********************/
class W10_2BuilderImpl implements W10_2.W10_2Builder {
protected String id;
protected TestEnum role;
@Override
@RosettaAttribute("id")
public String getId() {
return id;
}
@Override
@RosettaAttribute("role")
public TestEnum getRole() {
return role;
}
@Override
@RosettaAttribute("id")
public W10_2.W10_2Builder setId(String _id) {
this.id = _id == null ? null : _id;
return this;
}
@Override
@RosettaAttribute("role")
public W10_2.W10_2Builder setRole(TestEnum _role) {
this.role = _role == null ? null : _role;
return this;
}
@Override
public W10_2 build() {
return new W10_2.W10_2Impl(this);
}
@Override
public W10_2.W10_2Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public W10_2.W10_2Builder prune() {
return this;
}
@Override
public boolean hasData() {
if (getId()!=null) return true;
if (getRole()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public W10_2.W10_2Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
W10_2.W10_2Builder o = (W10_2.W10_2Builder) other;
merger.mergeBasic(getId(), o.getId(), this::setId);
merger.mergeBasic(getRole(), o.getRole(), this::setRole);
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;
W10_2 _that = getType().cast(o);
if (!Objects.equals(id, _that.getId())) return false;
if (!Objects.equals(role, _that.getRole())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (id != null ? id.hashCode() : 0);
_result = 31 * _result + (role != null ? role.getClass().getName().hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "W10_2Builder {" +
"id=" + this.id + ", " +
"role=" + this.role +
'}';
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy