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

com.rosetta.testconditional.model.V30 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.V30;
import com.rosetta.testconditional.model.V30.V30Builder;
import com.rosetta.testconditional.model.V30.V30BuilderImpl;
import com.rosetta.testconditional.model.V30.V30Impl;
import com.rosetta.testconditional.model.W30;
import com.rosetta.testconditional.model.meta.V30Meta;
import java.util.Objects;

import static java.util.Optional.ofNullable;

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

	V30Meta metaData = new V30Meta();

	/*********************** Getter Methods  ***********************/
	W30 getWField();

	/*********************** Build Methods  ***********************/
	V30 build();
	
	V30.V30Builder toBuilder();
	
	static V30.V30Builder builder() {
		return new V30.V30BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return V30.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("wField"), processor, W30.class, getWField());
	}
	

	/*********************** Builder Interface  ***********************/
	interface V30Builder extends V30, RosettaModelObjectBuilder {
		W30.W30Builder getOrCreateWField();
		W30.W30Builder getWField();
		V30.V30Builder setWField(W30 wField);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("wField"), processor, W30.W30Builder.class, getWField());
		}
		

		V30.V30Builder prune();
	}

	/*********************** Immutable Implementation of V30  ***********************/
	class V30Impl implements V30 {
		private final W30 wField;
		
		protected V30Impl(V30.V30Builder builder) {
			this.wField = ofNullable(builder.getWField()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("wField")
		public W30 getWField() {
			return wField;
		}
		
		@Override
		public V30 build() {
			return this;
		}
		
		@Override
		public V30.V30Builder toBuilder() {
			V30.V30Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(V30.V30Builder builder) {
			ofNullable(getWField()).ifPresent(builder::setWField);
		}

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

	/*********************** Builder Implementation of V30  ***********************/
	class V30BuilderImpl implements V30.V30Builder {
	
		protected W30.W30Builder wField;
	
		public V30BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("wField")
		public W30.W30Builder getWField() {
			return wField;
		}
		
		@Override
		public W30.W30Builder getOrCreateWField() {
			W30.W30Builder result;
			if (wField!=null) {
				result = wField;
			}
			else {
				result = wField = W30.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("wField")
		public V30.V30Builder setWField(W30 wField) {
			this.wField = wField==null?null:wField.toBuilder();
			return this;
		}
		
		@Override
		public V30 build() {
			return new V30.V30Impl(this);
		}
		
		@Override
		public V30.V30Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public V30.V30Builder prune() {
			if (wField!=null && !wField.prune().hasData()) wField = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getWField()!=null && getWField().hasData()) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public V30.V30Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			V30.V30Builder o = (V30.V30Builder) other;
			
			merger.mergeRosetta(getWField(), o.getWField(), this::setWField);
			
			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;
		
			V30 _that = getType().cast(o);
		
			if (!Objects.equals(wField, _that.getWField())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (wField != null ? wField.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "V30Builder {" +
				"wField=" + this.wField +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy