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

com.rosetta.testconditional.model.X26_4 Maven / Gradle / Ivy

There is a newer version: 11.25.1
Show newest version
package com.rosetta.testconditional.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.testconditional.model.X26_4;
import com.rosetta.testconditional.model.X26_4.X26_4Builder;
import com.rosetta.testconditional.model.X26_4.X26_4BuilderImpl;
import com.rosetta.testconditional.model.X26_4.X26_4Impl;
import com.rosetta.testconditional.model.Y26_4;
import com.rosetta.testconditional.model.meta.X26_4Meta;
import java.util.Objects;

import static java.util.Optional.ofNullable;

/**
 * @version test
 */
@RosettaDataType(value="X26_4", builder=X26_4.X26_4BuilderImpl.class, version="test")
public interface X26_4 extends RosettaModelObject {

	X26_4Meta metaData = new X26_4Meta();

	/*********************** Getter Methods  ***********************/
	Y26_4 getY1Field();
	Y26_4 getY2Field();

	/*********************** Build Methods  ***********************/
	X26_4 build();
	
	X26_4.X26_4Builder toBuilder();
	
	static X26_4.X26_4Builder builder() {
		return new X26_4.X26_4BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return X26_4.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("y1Field"), processor, Y26_4.class, getY1Field());
		processRosetta(path.newSubPath("y2Field"), processor, Y26_4.class, getY2Field());
	}
	

	/*********************** Builder Interface  ***********************/
	interface X26_4Builder extends X26_4, RosettaModelObjectBuilder {
		Y26_4.Y26_4Builder getOrCreateY1Field();
		Y26_4.Y26_4Builder getY1Field();
		Y26_4.Y26_4Builder getOrCreateY2Field();
		Y26_4.Y26_4Builder getY2Field();
		X26_4.X26_4Builder setY1Field(Y26_4 y1Field);
		X26_4.X26_4Builder setY2Field(Y26_4 y2Field);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("y1Field"), processor, Y26_4.Y26_4Builder.class, getY1Field());
			processRosetta(path.newSubPath("y2Field"), processor, Y26_4.Y26_4Builder.class, getY2Field());
		}
		

		X26_4.X26_4Builder prune();
	}

	/*********************** Immutable Implementation of X26_4  ***********************/
	class X26_4Impl implements X26_4 {
		private final Y26_4 y1Field;
		private final Y26_4 y2Field;
		
		protected X26_4Impl(X26_4.X26_4Builder builder) {
			this.y1Field = ofNullable(builder.getY1Field()).map(f->f.build()).orElse(null);
			this.y2Field = ofNullable(builder.getY2Field()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("y1Field")
		public Y26_4 getY1Field() {
			return y1Field;
		}
		
		@Override
		@RosettaAttribute("y2Field")
		public Y26_4 getY2Field() {
			return y2Field;
		}
		
		@Override
		public X26_4 build() {
			return this;
		}
		
		@Override
		public X26_4.X26_4Builder toBuilder() {
			X26_4.X26_4Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(X26_4.X26_4Builder builder) {
			ofNullable(getY1Field()).ifPresent(builder::setY1Field);
			ofNullable(getY2Field()).ifPresent(builder::setY2Field);
		}

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

	/*********************** Builder Implementation of X26_4  ***********************/
	class X26_4BuilderImpl implements X26_4.X26_4Builder {
	
		protected Y26_4.Y26_4Builder y1Field;
		protected Y26_4.Y26_4Builder y2Field;
	
		public X26_4BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("y1Field")
		public Y26_4.Y26_4Builder getY1Field() {
			return y1Field;
		}
		
		@Override
		public Y26_4.Y26_4Builder getOrCreateY1Field() {
			Y26_4.Y26_4Builder result;
			if (y1Field!=null) {
				result = y1Field;
			}
			else {
				result = y1Field = Y26_4.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("y2Field")
		public Y26_4.Y26_4Builder getY2Field() {
			return y2Field;
		}
		
		@Override
		public Y26_4.Y26_4Builder getOrCreateY2Field() {
			Y26_4.Y26_4Builder result;
			if (y2Field!=null) {
				result = y2Field;
			}
			else {
				result = y2Field = Y26_4.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("y1Field")
		public X26_4.X26_4Builder setY1Field(Y26_4 y1Field) {
			this.y1Field = y1Field==null?null:y1Field.toBuilder();
			return this;
		}
		@Override
		@RosettaAttribute("y2Field")
		public X26_4.X26_4Builder setY2Field(Y26_4 y2Field) {
			this.y2Field = y2Field==null?null:y2Field.toBuilder();
			return this;
		}
		
		@Override
		public X26_4 build() {
			return new X26_4.X26_4Impl(this);
		}
		
		@Override
		public X26_4.X26_4Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public X26_4.X26_4Builder prune() {
			if (y1Field!=null && !y1Field.prune().hasData()) y1Field = null;
			if (y2Field!=null && !y2Field.prune().hasData()) y2Field = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getY1Field()!=null && getY1Field().hasData()) return true;
			if (getY2Field()!=null && getY2Field().hasData()) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public X26_4.X26_4Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			X26_4.X26_4Builder o = (X26_4.X26_4Builder) other;
			
			merger.mergeRosetta(getY1Field(), o.getY1Field(), this::setY1Field);
			merger.mergeRosetta(getY2Field(), o.getY2Field(), this::setY2Field);
			
			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;
		
			X26_4 _that = getType().cast(o);
		
			if (!Objects.equals(y1Field, _that.getY1Field())) return false;
			if (!Objects.equals(y2Field, _that.getY2Field())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (y1Field != null ? y1Field.hashCode() : 0);
			_result = 31 * _result + (y2Field != null ? y2Field.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "X26_4Builder {" +
				"y1Field=" + this.y1Field + ", " +
				"y2Field=" + this.y2Field +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy