All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.rosetta.mappingprocessortest.model.Top10b Maven / Gradle / Ivy

There is a newer version: 11.25.1
Show newest version
package com.rosetta.mappingprocessortest.model;

import com.rosetta.mappingprocessortest.model.Top10b;
import com.rosetta.mappingprocessortest.model.Top10b.Top10bBuilder;
import com.rosetta.mappingprocessortest.model.Top10b.Top10bBuilderImpl;
import com.rosetta.mappingprocessortest.model.Top10b.Top10bImpl;
import com.rosetta.mappingprocessortest.model.Y10b;
import com.rosetta.mappingprocessortest.model.Z10b;
import com.rosetta.mappingprocessortest.model.meta.Top10bMeta;
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="Top10b", builder=Top10b.Top10bBuilderImpl.class, version="test")
public interface Top10b extends RosettaModelObject {

	Top10bMeta metaData = new Top10bMeta();

	/*********************** Getter Methods  ***********************/
	Y10b getYField();
	Z10b getZField();

	/*********************** Build Methods  ***********************/
	Top10b build();
	
	Top10b.Top10bBuilder toBuilder();
	
	static Top10b.Top10bBuilder builder() {
		return new Top10b.Top10bBuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return Top10b.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("yField"), processor, Y10b.class, getYField());
		processRosetta(path.newSubPath("zField"), processor, Z10b.class, getZField());
	}
	

	/*********************** Builder Interface  ***********************/
	interface Top10bBuilder extends Top10b, RosettaModelObjectBuilder {
		Y10b.Y10bBuilder getOrCreateYField();
		Y10b.Y10bBuilder getYField();
		Z10b.Z10bBuilder getOrCreateZField();
		Z10b.Z10bBuilder getZField();
		Top10b.Top10bBuilder setYField(Y10b yField);
		Top10b.Top10bBuilder setZField(Z10b zField);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("yField"), processor, Y10b.Y10bBuilder.class, getYField());
			processRosetta(path.newSubPath("zField"), processor, Z10b.Z10bBuilder.class, getZField());
		}
		

		Top10b.Top10bBuilder prune();
	}

	/*********************** Immutable Implementation of Top10b  ***********************/
	class Top10bImpl implements Top10b {
		private final Y10b yField;
		private final Z10b zField;
		
		protected Top10bImpl(Top10b.Top10bBuilder builder) {
			this.yField = ofNullable(builder.getYField()).map(f->f.build()).orElse(null);
			this.zField = ofNullable(builder.getZField()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("yField")
		public Y10b getYField() {
			return yField;
		}
		
		@Override
		@RosettaAttribute("zField")
		public Z10b getZField() {
			return zField;
		}
		
		@Override
		public Top10b build() {
			return this;
		}
		
		@Override
		public Top10b.Top10bBuilder toBuilder() {
			Top10b.Top10bBuilder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(Top10b.Top10bBuilder builder) {
			ofNullable(getYField()).ifPresent(builder::setYField);
			ofNullable(getZField()).ifPresent(builder::setZField);
		}

		@Override
		public boolean equals(Object o) {
			if (this == o) return true;
			if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
		
			Top10b _that = getType().cast(o);
		
			if (!Objects.equals(yField, _that.getYField())) return false;
			if (!Objects.equals(zField, _that.getZField())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (yField != null ? yField.hashCode() : 0);
			_result = 31 * _result + (zField != null ? zField.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "Top10b {" +
				"yField=" + this.yField + ", " +
				"zField=" + this.zField +
			'}';
		}
	}

	/*********************** Builder Implementation of Top10b  ***********************/
	class Top10bBuilderImpl implements Top10b.Top10bBuilder {
	
		protected Y10b.Y10bBuilder yField;
		protected Z10b.Z10bBuilder zField;
	
		public Top10bBuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("yField")
		public Y10b.Y10bBuilder getYField() {
			return yField;
		}
		
		@Override
		public Y10b.Y10bBuilder getOrCreateYField() {
			Y10b.Y10bBuilder result;
			if (yField!=null) {
				result = yField;
			}
			else {
				result = yField = Y10b.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("zField")
		public Z10b.Z10bBuilder getZField() {
			return zField;
		}
		
		@Override
		public Z10b.Z10bBuilder getOrCreateZField() {
			Z10b.Z10bBuilder result;
			if (zField!=null) {
				result = zField;
			}
			else {
				result = zField = Z10b.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("yField")
		public Top10b.Top10bBuilder setYField(Y10b yField) {
			this.yField = yField==null?null:yField.toBuilder();
			return this;
		}
		@Override
		@RosettaAttribute("zField")
		public Top10b.Top10bBuilder setZField(Z10b zField) {
			this.zField = zField==null?null:zField.toBuilder();
			return this;
		}
		
		@Override
		public Top10b build() {
			return new Top10b.Top10bImpl(this);
		}
		
		@Override
		public Top10b.Top10bBuilder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Top10b.Top10bBuilder prune() {
			if (yField!=null && !yField.prune().hasData()) yField = null;
			if (zField!=null && !zField.prune().hasData()) zField = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getYField()!=null && getYField().hasData()) return true;
			if (getZField()!=null && getZField().hasData()) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Top10b.Top10bBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			Top10b.Top10bBuilder o = (Top10b.Top10bBuilder) other;
			
			merger.mergeRosetta(getYField(), o.getYField(), this::setYField);
			merger.mergeRosetta(getZField(), o.getZField(), this::setZField);
			
			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;
		
			Top10b _that = getType().cast(o);
		
			if (!Objects.equals(yField, _that.getYField())) return false;
			if (!Objects.equals(zField, _that.getZField())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (yField != null ? yField.hashCode() : 0);
			_result = 31 * _result + (zField != null ? zField.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "Top10bBuilder {" +
				"yField=" + this.yField + ", " +
				"zField=" + this.zField +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy