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

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

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

import com.rosetta.mappingprocessortest.model.Top6;
import com.rosetta.mappingprocessortest.model.Top6.Top6Builder;
import com.rosetta.mappingprocessortest.model.Top6.Top6BuilderImpl;
import com.rosetta.mappingprocessortest.model.Top6.Top6Impl;
import com.rosetta.mappingprocessortest.model.X6;
import com.rosetta.mappingprocessortest.model.Y6;
import com.rosetta.mappingprocessortest.model.Z6;
import com.rosetta.mappingprocessortest.model.meta.Top6Meta;
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="Top6", builder=Top6.Top6BuilderImpl.class, version="test")
public interface Top6 extends RosettaModelObject {

	Top6Meta metaData = new Top6Meta();

	/*********************** Getter Methods  ***********************/
	X6 getXField();
	Y6 getYField();
	Z6 getZField();

	/*********************** Build Methods  ***********************/
	Top6 build();
	
	Top6.Top6Builder toBuilder();
	
	static Top6.Top6Builder builder() {
		return new Top6.Top6BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return Top6.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("xField"), processor, X6.class, getXField());
		processRosetta(path.newSubPath("yField"), processor, Y6.class, getYField());
		processRosetta(path.newSubPath("zField"), processor, Z6.class, getZField());
	}
	

	/*********************** Builder Interface  ***********************/
	interface Top6Builder extends Top6, RosettaModelObjectBuilder {
		X6.X6Builder getOrCreateXField();
		X6.X6Builder getXField();
		Y6.Y6Builder getOrCreateYField();
		Y6.Y6Builder getYField();
		Z6.Z6Builder getOrCreateZField();
		Z6.Z6Builder getZField();
		Top6.Top6Builder setXField(X6 xField);
		Top6.Top6Builder setYField(Y6 yField);
		Top6.Top6Builder setZField(Z6 zField);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("xField"), processor, X6.X6Builder.class, getXField());
			processRosetta(path.newSubPath("yField"), processor, Y6.Y6Builder.class, getYField());
			processRosetta(path.newSubPath("zField"), processor, Z6.Z6Builder.class, getZField());
		}
		

		Top6.Top6Builder prune();
	}

	/*********************** Immutable Implementation of Top6  ***********************/
	class Top6Impl implements Top6 {
		private final X6 xField;
		private final Y6 yField;
		private final Z6 zField;
		
		protected Top6Impl(Top6.Top6Builder builder) {
			this.xField = ofNullable(builder.getXField()).map(f->f.build()).orElse(null);
			this.yField = ofNullable(builder.getYField()).map(f->f.build()).orElse(null);
			this.zField = ofNullable(builder.getZField()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("xField")
		public X6 getXField() {
			return xField;
		}
		
		@Override
		@RosettaAttribute("yField")
		public Y6 getYField() {
			return yField;
		}
		
		@Override
		@RosettaAttribute("zField")
		public Z6 getZField() {
			return zField;
		}
		
		@Override
		public Top6 build() {
			return this;
		}
		
		@Override
		public Top6.Top6Builder toBuilder() {
			Top6.Top6Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(Top6.Top6Builder builder) {
			ofNullable(getXField()).ifPresent(builder::setXField);
			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;
		
			Top6 _that = getType().cast(o);
		
			if (!Objects.equals(xField, _that.getXField())) return false;
			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 + (xField != null ? xField.hashCode() : 0);
			_result = 31 * _result + (yField != null ? yField.hashCode() : 0);
			_result = 31 * _result + (zField != null ? zField.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "Top6 {" +
				"xField=" + this.xField + ", " +
				"yField=" + this.yField + ", " +
				"zField=" + this.zField +
			'}';
		}
	}

	/*********************** Builder Implementation of Top6  ***********************/
	class Top6BuilderImpl implements Top6.Top6Builder {
	
		protected X6.X6Builder xField;
		protected Y6.Y6Builder yField;
		protected Z6.Z6Builder zField;
	
		public Top6BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("xField")
		public X6.X6Builder getXField() {
			return xField;
		}
		
		@Override
		public X6.X6Builder getOrCreateXField() {
			X6.X6Builder result;
			if (xField!=null) {
				result = xField;
			}
			else {
				result = xField = X6.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("yField")
		public Y6.Y6Builder getYField() {
			return yField;
		}
		
		@Override
		public Y6.Y6Builder getOrCreateYField() {
			Y6.Y6Builder result;
			if (yField!=null) {
				result = yField;
			}
			else {
				result = yField = Y6.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("zField")
		public Z6.Z6Builder getZField() {
			return zField;
		}
		
		@Override
		public Z6.Z6Builder getOrCreateZField() {
			Z6.Z6Builder result;
			if (zField!=null) {
				result = zField;
			}
			else {
				result = zField = Z6.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("xField")
		public Top6.Top6Builder setXField(X6 xField) {
			this.xField = xField==null?null:xField.toBuilder();
			return this;
		}
		@Override
		@RosettaAttribute("yField")
		public Top6.Top6Builder setYField(Y6 yField) {
			this.yField = yField==null?null:yField.toBuilder();
			return this;
		}
		@Override
		@RosettaAttribute("zField")
		public Top6.Top6Builder setZField(Z6 zField) {
			this.zField = zField==null?null:zField.toBuilder();
			return this;
		}
		
		@Override
		public Top6 build() {
			return new Top6.Top6Impl(this);
		}
		
		@Override
		public Top6.Top6Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Top6.Top6Builder prune() {
			if (xField!=null && !xField.prune().hasData()) xField = null;
			if (yField!=null && !yField.prune().hasData()) yField = null;
			if (zField!=null && !zField.prune().hasData()) zField = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getXField()!=null && getXField().hasData()) return true;
			if (getYField()!=null && getYField().hasData()) return true;
			if (getZField()!=null && getZField().hasData()) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Top6.Top6Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			Top6.Top6Builder o = (Top6.Top6Builder) other;
			
			merger.mergeRosetta(getXField(), o.getXField(), this::setXField);
			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;
		
			Top6 _that = getType().cast(o);
		
			if (!Objects.equals(xField, _that.getXField())) return false;
			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 + (xField != null ? xField.hashCode() : 0);
			_result = 31 * _result + (yField != null ? yField.hashCode() : 0);
			_result = 31 * _result + (zField != null ? zField.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "Top6Builder {" +
				"xField=" + this.xField + ", " +
				"yField=" + this.yField + ", " +
				"zField=" + this.zField +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy