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