com.rosetta.externalsynonym.model.AssignedIdentifier7 Maven / Gradle / Ivy
package com.rosetta.externalsynonym.model;
import com.rosetta.externalsynonym.model.AssignedIdentifier7;
import com.rosetta.externalsynonym.model.AssignedIdentifier7.AssignedIdentifier7Builder;
import com.rosetta.externalsynonym.model.AssignedIdentifier7.AssignedIdentifier7BuilderImpl;
import com.rosetta.externalsynonym.model.AssignedIdentifier7.AssignedIdentifier7Impl;
import com.rosetta.externalsynonym.model.meta.AssignedIdentifier7Meta;
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.model.metafields.FieldWithMetaString;
import com.rosetta.model.metafields.FieldWithMetaString.FieldWithMetaStringBuilder;
import java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="AssignedIdentifier7", builder=AssignedIdentifier7.AssignedIdentifier7BuilderImpl.class, version="test")
public interface AssignedIdentifier7 extends RosettaModelObject {
AssignedIdentifier7Meta metaData = new AssignedIdentifier7Meta();
/*********************** Getter Methods ***********************/
FieldWithMetaString getIdentifier();
/*********************** Build Methods ***********************/
AssignedIdentifier7 build();
AssignedIdentifier7.AssignedIdentifier7Builder toBuilder();
static AssignedIdentifier7.AssignedIdentifier7Builder builder() {
return new AssignedIdentifier7.AssignedIdentifier7BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends AssignedIdentifier7> metaData() {
return metaData;
}
@Override
default Class extends AssignedIdentifier7> getType() {
return AssignedIdentifier7.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processRosetta(path.newSubPath("identifier"), processor, FieldWithMetaString.class, getIdentifier());
}
/*********************** Builder Interface ***********************/
interface AssignedIdentifier7Builder extends AssignedIdentifier7, RosettaModelObjectBuilder {
FieldWithMetaString.FieldWithMetaStringBuilder getOrCreateIdentifier();
FieldWithMetaString.FieldWithMetaStringBuilder getIdentifier();
AssignedIdentifier7.AssignedIdentifier7Builder setIdentifier(FieldWithMetaString identifier0);
AssignedIdentifier7.AssignedIdentifier7Builder setIdentifierValue(String identifier1);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processRosetta(path.newSubPath("identifier"), processor, FieldWithMetaString.FieldWithMetaStringBuilder.class, getIdentifier());
}
AssignedIdentifier7.AssignedIdentifier7Builder prune();
}
/*********************** Immutable Implementation of AssignedIdentifier7 ***********************/
class AssignedIdentifier7Impl implements AssignedIdentifier7 {
private final FieldWithMetaString identifier;
protected AssignedIdentifier7Impl(AssignedIdentifier7.AssignedIdentifier7Builder builder) {
this.identifier = ofNullable(builder.getIdentifier()).map(f->f.build()).orElse(null);
}
@Override
@RosettaAttribute("identifier")
public FieldWithMetaString getIdentifier() {
return identifier;
}
@Override
public AssignedIdentifier7 build() {
return this;
}
@Override
public AssignedIdentifier7.AssignedIdentifier7Builder toBuilder() {
AssignedIdentifier7.AssignedIdentifier7Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(AssignedIdentifier7.AssignedIdentifier7Builder builder) {
ofNullable(getIdentifier()).ifPresent(builder::setIdentifier);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
AssignedIdentifier7 _that = getType().cast(o);
if (!Objects.equals(identifier, _that.getIdentifier())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (identifier != null ? identifier.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "AssignedIdentifier7 {" +
"identifier=" + this.identifier +
'}';
}
}
/*********************** Builder Implementation of AssignedIdentifier7 ***********************/
class AssignedIdentifier7BuilderImpl implements AssignedIdentifier7.AssignedIdentifier7Builder {
protected FieldWithMetaString.FieldWithMetaStringBuilder identifier;
public AssignedIdentifier7BuilderImpl() {
}
@Override
@RosettaAttribute("identifier")
public FieldWithMetaString.FieldWithMetaStringBuilder getIdentifier() {
return identifier;
}
@Override
public FieldWithMetaString.FieldWithMetaStringBuilder getOrCreateIdentifier() {
FieldWithMetaString.FieldWithMetaStringBuilder result;
if (identifier!=null) {
result = identifier;
}
else {
result = identifier = FieldWithMetaString.builder();
}
return result;
}
@Override
@RosettaAttribute("identifier")
public AssignedIdentifier7.AssignedIdentifier7Builder setIdentifier(FieldWithMetaString identifier) {
this.identifier = identifier==null?null:identifier.toBuilder();
return this;
}
@Override
public AssignedIdentifier7.AssignedIdentifier7Builder setIdentifierValue(String identifier) {
this.getOrCreateIdentifier().setValue(identifier);
return this;
}
@Override
public AssignedIdentifier7 build() {
return new AssignedIdentifier7.AssignedIdentifier7Impl(this);
}
@Override
public AssignedIdentifier7.AssignedIdentifier7Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public AssignedIdentifier7.AssignedIdentifier7Builder prune() {
if (identifier!=null && !identifier.prune().hasData()) identifier = null;
return this;
}
@Override
public boolean hasData() {
if (getIdentifier()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public AssignedIdentifier7.AssignedIdentifier7Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
AssignedIdentifier7.AssignedIdentifier7Builder o = (AssignedIdentifier7.AssignedIdentifier7Builder) other;
merger.mergeRosetta(getIdentifier(), o.getIdentifier(), this::setIdentifier);
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;
AssignedIdentifier7 _that = getType().cast(o);
if (!Objects.equals(identifier, _that.getIdentifier())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (identifier != null ? identifier.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "AssignedIdentifier7Builder {" +
"identifier=" + this.identifier +
'}';
}
}
}