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