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

com.rosetta.testconditional.model.V29 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.V29;
import com.rosetta.testconditional.model.V29.V29Builder;
import com.rosetta.testconditional.model.V29.V29BuilderImpl;
import com.rosetta.testconditional.model.V29.V29Impl;
import com.rosetta.testconditional.model.W29;
import com.rosetta.testconditional.model.meta.V29Meta;
import java.util.Objects;

import static java.util.Optional.ofNullable;

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

	V29Meta metaData = new V29Meta();

	/*********************** Getter Methods  ***********************/
	W29 getWField1();
	W29 getWField2();

	/*********************** Build Methods  ***********************/
	V29 build();
	
	V29.V29Builder toBuilder();
	
	static V29.V29Builder builder() {
		return new V29.V29BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return V29.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("wField1"), processor, W29.class, getWField1());
		processRosetta(path.newSubPath("wField2"), processor, W29.class, getWField2());
	}
	

	/*********************** Builder Interface  ***********************/
	interface V29Builder extends V29, RosettaModelObjectBuilder {
		W29.W29Builder getOrCreateWField1();
		W29.W29Builder getWField1();
		W29.W29Builder getOrCreateWField2();
		W29.W29Builder getWField2();
		V29.V29Builder setWField1(W29 wField1);
		V29.V29Builder setWField2(W29 wField2);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("wField1"), processor, W29.W29Builder.class, getWField1());
			processRosetta(path.newSubPath("wField2"), processor, W29.W29Builder.class, getWField2());
		}
		

		V29.V29Builder prune();
	}

	/*********************** Immutable Implementation of V29  ***********************/
	class V29Impl implements V29 {
		private final W29 wField1;
		private final W29 wField2;
		
		protected V29Impl(V29.V29Builder builder) {
			this.wField1 = ofNullable(builder.getWField1()).map(f->f.build()).orElse(null);
			this.wField2 = ofNullable(builder.getWField2()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("wField1")
		public W29 getWField1() {
			return wField1;
		}
		
		@Override
		@RosettaAttribute("wField2")
		public W29 getWField2() {
			return wField2;
		}
		
		@Override
		public V29 build() {
			return this;
		}
		
		@Override
		public V29.V29Builder toBuilder() {
			V29.V29Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(V29.V29Builder builder) {
			ofNullable(getWField1()).ifPresent(builder::setWField1);
			ofNullable(getWField2()).ifPresent(builder::setWField2);
		}

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

	/*********************** Builder Implementation of V29  ***********************/
	class V29BuilderImpl implements V29.V29Builder {
	
		protected W29.W29Builder wField1;
		protected W29.W29Builder wField2;
	
		public V29BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("wField1")
		public W29.W29Builder getWField1() {
			return wField1;
		}
		
		@Override
		public W29.W29Builder getOrCreateWField1() {
			W29.W29Builder result;
			if (wField1!=null) {
				result = wField1;
			}
			else {
				result = wField1 = W29.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("wField2")
		public W29.W29Builder getWField2() {
			return wField2;
		}
		
		@Override
		public W29.W29Builder getOrCreateWField2() {
			W29.W29Builder result;
			if (wField2!=null) {
				result = wField2;
			}
			else {
				result = wField2 = W29.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("wField1")
		public V29.V29Builder setWField1(W29 wField1) {
			this.wField1 = wField1==null?null:wField1.toBuilder();
			return this;
		}
		@Override
		@RosettaAttribute("wField2")
		public V29.V29Builder setWField2(W29 wField2) {
			this.wField2 = wField2==null?null:wField2.toBuilder();
			return this;
		}
		
		@Override
		public V29 build() {
			return new V29.V29Impl(this);
		}
		
		@Override
		public V29.V29Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public V29.V29Builder prune() {
			if (wField1!=null && !wField1.prune().hasData()) wField1 = null;
			if (wField2!=null && !wField2.prune().hasData()) wField2 = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getWField1()!=null && getWField1().hasData()) return true;
			if (getWField2()!=null && getWField2().hasData()) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public V29.V29Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			V29.V29Builder o = (V29.V29Builder) other;
			
			merger.mergeRosetta(getWField1(), o.getWField1(), this::setWField1);
			merger.mergeRosetta(getWField2(), o.getWField2(), this::setWField2);
			
			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;
		
			V29 _that = getType().cast(o);
		
			if (!Objects.equals(wField1, _that.getWField1())) return false;
			if (!Objects.equals(wField2, _that.getWField2())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (wField1 != null ? wField1.hashCode() : 0);
			_result = 31 * _result + (wField2 != null ? wField2.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "V29Builder {" +
				"wField1=" + this.wField1 + ", " +
				"wField2=" + this.wField2 +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy