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

com.rosetta.testconditional.model.V13 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.V13;
import com.rosetta.testconditional.model.V13.V13Builder;
import com.rosetta.testconditional.model.V13.V13BuilderImpl;
import com.rosetta.testconditional.model.V13.V13Impl;
import com.rosetta.testconditional.model.W13;
import com.rosetta.testconditional.model.meta.V13Meta;
import java.util.Objects;

import static java.util.Optional.ofNullable;

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

	V13Meta metaData = new V13Meta();

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

	/*********************** Build Methods  ***********************/
	V13 build();
	
	V13.V13Builder toBuilder();
	
	static V13.V13Builder builder() {
		return new V13.V13BuilderImpl();
	}

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

	/*********************** Builder Interface  ***********************/
	interface V13Builder extends V13, RosettaModelObjectBuilder {
		W13.W13Builder getOrCreateWField();
		W13.W13Builder getWField();
		V13.V13Builder setWField(W13 wField);

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

		V13.V13Builder prune();
	}

	/*********************** Immutable Implementation of V13  ***********************/
	class V13Impl implements V13 {
		private final W13 wField;
		
		protected V13Impl(V13.V13Builder builder) {
			this.wField = ofNullable(builder.getWField()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("wField")
		public W13 getWField() {
			return wField;
		}
		
		@Override
		public V13 build() {
			return this;
		}
		
		@Override
		public V13.V13Builder toBuilder() {
			V13.V13Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(V13.V13Builder 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;
		
			V13 _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 "V13 {" +
				"wField=" + this.wField +
			'}';
		}
	}

	/*********************** Builder Implementation of V13  ***********************/
	class V13BuilderImpl implements V13.V13Builder {
	
		protected W13.W13Builder wField;
	
		public V13BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("wField")
		public W13.W13Builder getWField() {
			return wField;
		}
		
		@Override
		public W13.W13Builder getOrCreateWField() {
			W13.W13Builder result;
			if (wField!=null) {
				result = wField;
			}
			else {
				result = wField = W13.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("wField")
		public V13.V13Builder setWField(W13 wField) {
			this.wField = wField==null?null:wField.toBuilder();
			return this;
		}
		
		@Override
		public V13 build() {
			return new V13.V13Impl(this);
		}
		
		@Override
		public V13.V13Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public V13.V13Builder 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 V13.V13Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			V13.V13Builder o = (V13.V13Builder) 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;
		
			V13 _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 "V13Builder {" +
				"wField=" + this.wField +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy