com.rosetta.teststruct.model.A6 Maven / Gradle / Ivy
The newest version!
package com.rosetta.teststruct.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.teststruct.model.A6;
import com.rosetta.teststruct.model.A6.A6Builder;
import com.rosetta.teststruct.model.A6.A6BuilderImpl;
import com.rosetta.teststruct.model.A6.A6Impl;
import com.rosetta.teststruct.model.B6;
import com.rosetta.teststruct.model.B6.B6Builder;
import com.rosetta.teststruct.model.meta.A6Meta;
import java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="A6", builder=A6.A6BuilderImpl.class, version="test")
public interface A6 extends RosettaModelObject {
A6Meta metaData = new A6Meta();
/*********************** Getter Methods ***********************/
B6 getBField();
/*********************** Build Methods ***********************/
A6 build();
A6.A6Builder toBuilder();
static A6.A6Builder builder() {
return new A6.A6BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends A6> metaData() {
return metaData;
}
@Override
default Class extends A6> getType() {
return A6.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processRosetta(path.newSubPath("bField"), processor, B6.class, getBField());
}
/*********************** Builder Interface ***********************/
interface A6Builder extends A6, RosettaModelObjectBuilder {
B6.B6Builder getOrCreateBField();
@Override
B6.B6Builder getBField();
A6.A6Builder setBField(B6 bField);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processRosetta(path.newSubPath("bField"), processor, B6.B6Builder.class, getBField());
}
A6.A6Builder prune();
}
/*********************** Immutable Implementation of A6 ***********************/
class A6Impl implements A6 {
private final B6 bField;
protected A6Impl(A6.A6Builder builder) {
this.bField = ofNullable(builder.getBField()).map(f->f.build()).orElse(null);
}
@Override
@RosettaAttribute("bField")
public B6 getBField() {
return bField;
}
@Override
public A6 build() {
return this;
}
@Override
public A6.A6Builder toBuilder() {
A6.A6Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(A6.A6Builder builder) {
ofNullable(getBField()).ifPresent(builder::setBField);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
A6 _that = getType().cast(o);
if (!Objects.equals(bField, _that.getBField())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (bField != null ? bField.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "A6 {" +
"bField=" + this.bField +
'}';
}
}
/*********************** Builder Implementation of A6 ***********************/
class A6BuilderImpl implements A6.A6Builder {
protected B6.B6Builder bField;
@Override
@RosettaAttribute("bField")
public B6.B6Builder getBField() {
return bField;
}
@Override
public B6.B6Builder getOrCreateBField() {
B6.B6Builder result;
if (bField!=null) {
result = bField;
}
else {
result = bField = B6.builder();
}
return result;
}
@Override
@RosettaAttribute("bField")
public A6.A6Builder setBField(B6 _bField) {
this.bField = _bField == null ? null : _bField.toBuilder();
return this;
}
@Override
public A6 build() {
return new A6.A6Impl(this);
}
@Override
public A6.A6Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public A6.A6Builder prune() {
if (bField!=null && !bField.prune().hasData()) bField = null;
return this;
}
@Override
public boolean hasData() {
if (getBField()!=null && getBField().hasData()) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public A6.A6Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
A6.A6Builder o = (A6.A6Builder) other;
merger.mergeRosetta(getBField(), o.getBField(), this::setBField);
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;
A6 _that = getType().cast(o);
if (!Objects.equals(bField, _that.getBField())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (bField != null ? bField.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "A6Builder {" +
"bField=" + this.bField +
'}';
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy