com.rosetta.testconditional.model.W10 Maven / Gradle / Ivy
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;
import com.rosetta.testconditional.model.W10.W10Builder;
import com.rosetta.testconditional.model.W10.W10BuilderImpl;
import com.rosetta.testconditional.model.W10.W10Impl;
import com.rosetta.testconditional.model.meta.W10Meta;
import java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="W10", builder=W10.W10BuilderImpl.class, version="test")
public interface W10 extends RosettaModelObject {
W10Meta metaData = new W10Meta();
/*********************** Getter Methods ***********************/
String getId();
TestEnum getRole();
/*********************** Build Methods ***********************/
W10 build();
W10.W10Builder toBuilder();
static W10.W10Builder builder() {
return new W10.W10BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends W10> metaData() {
return metaData;
}
@Override
default Class extends W10> getType() {
return W10.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 W10Builder extends W10, RosettaModelObjectBuilder {
W10.W10Builder setId(String id);
W10.W10Builder 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.W10Builder prune();
}
/*********************** Immutable Implementation of W10 ***********************/
class W10Impl implements W10 {
private final String id;
private final TestEnum role;
protected W10Impl(W10.W10Builder 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 build() {
return this;
}
@Override
public W10.W10Builder toBuilder() {
W10.W10Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(W10.W10Builder 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 _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 {" +
"id=" + this.id + ", " +
"role=" + this.role +
'}';
}
}
/*********************** Builder Implementation of W10 ***********************/
class W10BuilderImpl implements W10.W10Builder {
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.W10Builder setId(String _id) {
this.id = _id == null ? null : _id;
return this;
}
@Override
@RosettaAttribute("role")
public W10.W10Builder setRole(TestEnum _role) {
this.role = _role == null ? null : _role;
return this;
}
@Override
public W10 build() {
return new W10.W10Impl(this);
}
@Override
public W10.W10Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public W10.W10Builder prune() {
return this;
}
@Override
public boolean hasData() {
if (getId()!=null) return true;
if (getRole()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public W10.W10Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
W10.W10Builder o = (W10.W10Builder) 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 _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 "W10Builder {" +
"id=" + this.id + ", " +
"role=" + this.role +
'}';
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy