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

com.rosetta.testconditional.model.Y9 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.Y9;
import com.rosetta.testconditional.model.Y9.Y9Builder;
import com.rosetta.testconditional.model.Y9.Y9BuilderImpl;
import com.rosetta.testconditional.model.Y9.Y9Impl;
import com.rosetta.testconditional.model.meta.Y9Meta;
import java.util.Objects;

import static java.util.Optional.ofNullable;

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

	Y9Meta metaData = new Y9Meta();

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

	/*********************** Build Methods  ***********************/
	Y9 build();
	
	Y9.Y9Builder toBuilder();
	
	static Y9.Y9Builder builder() {
		return new Y9.Y9BuilderImpl();
	}

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

	/*********************** Builder Interface  ***********************/
	interface Y9Builder extends Y9, RosettaModelObjectBuilder {
		Y9.Y9Builder setZField(TestEnum zField);

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

		Y9.Y9Builder prune();
	}

	/*********************** Immutable Implementation of Y9  ***********************/
	class Y9Impl implements Y9 {
		private final TestEnum zField;
		
		protected Y9Impl(Y9.Y9Builder builder) {
			this.zField = builder.getZField();
		}
		
		@Override
		@RosettaAttribute("zField")
		public TestEnum getZField() {
			return zField;
		}
		
		@Override
		public Y9 build() {
			return this;
		}
		
		@Override
		public Y9.Y9Builder toBuilder() {
			Y9.Y9Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(Y9.Y9Builder builder) {
			ofNullable(getZField()).ifPresent(builder::setZField);
		}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy