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

com.rosetta.testconditional.model.V14 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.TestEnum;
import com.rosetta.testconditional.model.V14;
import com.rosetta.testconditional.model.V14.V14Builder;
import com.rosetta.testconditional.model.V14.V14BuilderImpl;
import com.rosetta.testconditional.model.V14.V14Impl;
import com.rosetta.testconditional.model.meta.V14Meta;
import java.util.Objects;

import static java.util.Optional.ofNullable;

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

	V14Meta metaData = new V14Meta();

	/*********************** Getter Methods  ***********************/
	TestEnum getXField();

	/*********************** Build Methods  ***********************/
	V14 build();
	
	V14.V14Builder toBuilder();
	
	static V14.V14Builder builder() {
		return new V14.V14BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return V14.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processor.processBasic(path.newSubPath("xField"), TestEnum.class, getXField(), this);
	}
	

	/*********************** Builder Interface  ***********************/
	interface V14Builder extends V14, RosettaModelObjectBuilder {
		V14.V14Builder setXField(TestEnum xField);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processor.processBasic(path.newSubPath("xField"), TestEnum.class, getXField(), this);
		}
		

		V14.V14Builder prune();
	}

	/*********************** Immutable Implementation of V14  ***********************/
	class V14Impl implements V14 {
		private final TestEnum xField;
		
		protected V14Impl(V14.V14Builder builder) {
			this.xField = builder.getXField();
		}
		
		@Override
		@RosettaAttribute("xField")
		public TestEnum getXField() {
			return xField;
		}
		
		@Override
		public V14 build() {
			return this;
		}
		
		@Override
		public V14.V14Builder toBuilder() {
			V14.V14Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(V14.V14Builder builder) {
			ofNullable(getXField()).ifPresent(builder::setXField);
		}

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

	/*********************** Builder Implementation of V14  ***********************/
	class V14BuilderImpl implements V14.V14Builder {
	
		protected TestEnum xField;
	
		public V14BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("xField")
		public TestEnum getXField() {
			return xField;
		}
		
		@Override
		@RosettaAttribute("xField")
		public V14.V14Builder setXField(TestEnum xField) {
			this.xField = xField==null?null:xField;
			return this;
		}
		
		@Override
		public V14 build() {
			return new V14.V14Impl(this);
		}
		
		@Override
		public V14.V14Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public V14.V14Builder prune() {
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getXField()!=null) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public V14.V14Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			V14.V14Builder o = (V14.V14Builder) other;
			
			
			merger.mergeBasic(getXField(), o.getXField(), this::setXField);
			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;
		
			V14 _that = getType().cast(o);
		
			if (!Objects.equals(xField, _that.getXField())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (xField != null ? xField.getClass().getName().hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "V14Builder {" +
				"xField=" + this.xField +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy