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

com.rosetta.testconditional.model.Top26_1 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_1;
import com.rosetta.testconditional.model.Top26_1.Top26_1Builder;
import com.rosetta.testconditional.model.Top26_1.Top26_1BuilderImpl;
import com.rosetta.testconditional.model.Top26_1.Top26_1Impl;
import com.rosetta.testconditional.model.X26_1;
import com.rosetta.testconditional.model.meta.Top26_1Meta;
import java.util.Objects;

import static java.util.Optional.ofNullable;

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

	Top26_1Meta metaData = new Top26_1Meta();

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

	/*********************** Build Methods  ***********************/
	Top26_1 build();
	
	Top26_1.Top26_1Builder toBuilder();
	
	static Top26_1.Top26_1Builder builder() {
		return new Top26_1.Top26_1BuilderImpl();
	}

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

	/*********************** Builder Interface  ***********************/
	interface Top26_1Builder extends Top26_1, RosettaModelObjectBuilder {
		X26_1.X26_1Builder getOrCreateX1Field();
		X26_1.X26_1Builder getX1Field();
		X26_1.X26_1Builder getOrCreateX2Field();
		X26_1.X26_1Builder getX2Field();
		Top26_1.Top26_1Builder setX1Field(X26_1 x1Field);
		Top26_1.Top26_1Builder setX2Field(X26_1 x2Field);

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

		Top26_1.Top26_1Builder prune();
	}

	/*********************** Immutable Implementation of Top26_1  ***********************/
	class Top26_1Impl implements Top26_1 {
		private final X26_1 x1Field;
		private final X26_1 x2Field;
		
		protected Top26_1Impl(Top26_1.Top26_1Builder 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_1 getX1Field() {
			return x1Field;
		}
		
		@Override
		@RosettaAttribute("x2Field")
		public X26_1 getX2Field() {
			return x2Field;
		}
		
		@Override
		public Top26_1 build() {
			return this;
		}
		
		@Override
		public Top26_1.Top26_1Builder toBuilder() {
			Top26_1.Top26_1Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(Top26_1.Top26_1Builder 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_1 _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_1 {" +
				"x1Field=" + this.x1Field + ", " +
				"x2Field=" + this.x2Field +
			'}';
		}
	}

	/*********************** Builder Implementation of Top26_1  ***********************/
	class Top26_1BuilderImpl implements Top26_1.Top26_1Builder {
	
		protected X26_1.X26_1Builder x1Field;
		protected X26_1.X26_1Builder x2Field;
	
		public Top26_1BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("x1Field")
		public X26_1.X26_1Builder getX1Field() {
			return x1Field;
		}
		
		@Override
		public X26_1.X26_1Builder getOrCreateX1Field() {
			X26_1.X26_1Builder result;
			if (x1Field!=null) {
				result = x1Field;
			}
			else {
				result = x1Field = X26_1.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("x2Field")
		public X26_1.X26_1Builder getX2Field() {
			return x2Field;
		}
		
		@Override
		public X26_1.X26_1Builder getOrCreateX2Field() {
			X26_1.X26_1Builder result;
			if (x2Field!=null) {
				result = x2Field;
			}
			else {
				result = x2Field = X26_1.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("x1Field")
		public Top26_1.Top26_1Builder setX1Field(X26_1 x1Field) {
			this.x1Field = x1Field==null?null:x1Field.toBuilder();
			return this;
		}
		@Override
		@RosettaAttribute("x2Field")
		public Top26_1.Top26_1Builder setX2Field(X26_1 x2Field) {
			this.x2Field = x2Field==null?null:x2Field.toBuilder();
			return this;
		}
		
		@Override
		public Top26_1 build() {
			return new Top26_1.Top26_1Impl(this);
		}
		
		@Override
		public Top26_1.Top26_1Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Top26_1.Top26_1Builder 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_1.Top26_1Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			Top26_1.Top26_1Builder o = (Top26_1.Top26_1Builder) 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_1 _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_1Builder {" +
				"x1Field=" + this.x1Field + ", " +
				"x2Field=" + this.x2Field +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy