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

com.rosetta.testconditional.model.Top26_2 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.Top26_2;
import com.rosetta.testconditional.model.Top26_2.Top26_2Builder;
import com.rosetta.testconditional.model.Top26_2.Top26_2BuilderImpl;
import com.rosetta.testconditional.model.Top26_2.Top26_2Impl;
import com.rosetta.testconditional.model.X26_2;
import com.rosetta.testconditional.model.meta.Top26_2Meta;
import java.util.Objects;

import static java.util.Optional.ofNullable;

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

	Top26_2Meta metaData = new Top26_2Meta();

	/*********************** Getter Methods  ***********************/
	X26_2 getX1Field();
	X26_2 getX2Field();

	/*********************** Build Methods  ***********************/
	Top26_2 build();
	
	Top26_2.Top26_2Builder toBuilder();
	
	static Top26_2.Top26_2Builder builder() {
		return new Top26_2.Top26_2BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return Top26_2.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("x1Field"), processor, X26_2.class, getX1Field());
		processRosetta(path.newSubPath("x2Field"), processor, X26_2.class, getX2Field());
	}
	

	/*********************** Builder Interface  ***********************/
	interface Top26_2Builder extends Top26_2, RosettaModelObjectBuilder {
		X26_2.X26_2Builder getOrCreateX1Field();
		X26_2.X26_2Builder getX1Field();
		X26_2.X26_2Builder getOrCreateX2Field();
		X26_2.X26_2Builder getX2Field();
		Top26_2.Top26_2Builder setX1Field(X26_2 x1Field);
		Top26_2.Top26_2Builder setX2Field(X26_2 x2Field);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("x1Field"), processor, X26_2.X26_2Builder.class, getX1Field());
			processRosetta(path.newSubPath("x2Field"), processor, X26_2.X26_2Builder.class, getX2Field());
		}
		

		Top26_2.Top26_2Builder prune();
	}

	/*********************** Immutable Implementation of Top26_2  ***********************/
	class Top26_2Impl implements Top26_2 {
		private final X26_2 x1Field;
		private final X26_2 x2Field;
		
		protected Top26_2Impl(Top26_2.Top26_2Builder builder) {
			this.x1Field = ofNullable(builder.getX1Field()).map(f->f.build()).orElse(null);
			this.x2Field = ofNullable(builder.getX2Field()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("x1Field")
		public X26_2 getX1Field() {
			return x1Field;
		}
		
		@Override
		@RosettaAttribute("x2Field")
		public X26_2 getX2Field() {
			return x2Field;
		}
		
		@Override
		public Top26_2 build() {
			return this;
		}
		
		@Override
		public Top26_2.Top26_2Builder toBuilder() {
			Top26_2.Top26_2Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(Top26_2.Top26_2Builder builder) {
			ofNullable(getX1Field()).ifPresent(builder::setX1Field);
			ofNullable(getX2Field()).ifPresent(builder::setX2Field);
		}

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

	/*********************** Builder Implementation of Top26_2  ***********************/
	class Top26_2BuilderImpl implements Top26_2.Top26_2Builder {
	
		protected X26_2.X26_2Builder x1Field;
		protected X26_2.X26_2Builder x2Field;
	
		public Top26_2BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("x1Field")
		public X26_2.X26_2Builder getX1Field() {
			return x1Field;
		}
		
		@Override
		public X26_2.X26_2Builder getOrCreateX1Field() {
			X26_2.X26_2Builder result;
			if (x1Field!=null) {
				result = x1Field;
			}
			else {
				result = x1Field = X26_2.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("x2Field")
		public X26_2.X26_2Builder getX2Field() {
			return x2Field;
		}
		
		@Override
		public X26_2.X26_2Builder getOrCreateX2Field() {
			X26_2.X26_2Builder result;
			if (x2Field!=null) {
				result = x2Field;
			}
			else {
				result = x2Field = X26_2.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("x1Field")
		public Top26_2.Top26_2Builder setX1Field(X26_2 x1Field) {
			this.x1Field = x1Field==null?null:x1Field.toBuilder();
			return this;
		}
		@Override
		@RosettaAttribute("x2Field")
		public Top26_2.Top26_2Builder setX2Field(X26_2 x2Field) {
			this.x2Field = x2Field==null?null:x2Field.toBuilder();
			return this;
		}
		
		@Override
		public Top26_2 build() {
			return new Top26_2.Top26_2Impl(this);
		}
		
		@Override
		public Top26_2.Top26_2Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Top26_2.Top26_2Builder prune() {
			if (x1Field!=null && !x1Field.prune().hasData()) x1Field = null;
			if (x2Field!=null && !x2Field.prune().hasData()) x2Field = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getX1Field()!=null && getX1Field().hasData()) return true;
			if (getX2Field()!=null && getX2Field().hasData()) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Top26_2.Top26_2Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			Top26_2.Top26_2Builder o = (Top26_2.Top26_2Builder) other;
			
			merger.mergeRosetta(getX1Field(), o.getX1Field(), this::setX1Field);
			merger.mergeRosetta(getX2Field(), o.getX2Field(), this::setX2Field);
			
			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;
		
			Top26_2 _that = getType().cast(o);
		
			if (!Objects.equals(x1Field, _that.getX1Field())) return false;
			if (!Objects.equals(x2Field, _that.getX2Field())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (x1Field != null ? x1Field.hashCode() : 0);
			_result = 31 * _result + (x2Field != null ? x2Field.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "Top26_2Builder {" +
				"x1Field=" + this.x1Field + ", " +
				"x2Field=" + this.x2Field +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy