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

com.rosetta.testcard.model.X10_2 Maven / Gradle / Ivy

There is a newer version: 11.25.1
Show newest version
package com.rosetta.testcard.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.testcard.model.X10_2;
import com.rosetta.testcard.model.X10_2.X10_2Builder;
import com.rosetta.testcard.model.X10_2.X10_2BuilderImpl;
import com.rosetta.testcard.model.X10_2.X10_2Impl;
import com.rosetta.testcard.model.meta.X10_2Meta;
import java.util.Objects;

import static java.util.Optional.ofNullable;

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

	X10_2Meta metaData = new X10_2Meta();

	/*********************** Getter Methods  ***********************/
	String getYField();
	String getZField();

	/*********************** Build Methods  ***********************/
	X10_2 build();
	
	X10_2.X10_2Builder toBuilder();
	
	static X10_2.X10_2Builder builder() {
		return new X10_2.X10_2BuilderImpl();
	}

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

	/*********************** Builder Interface  ***********************/
	interface X10_2Builder extends X10_2, RosettaModelObjectBuilder {
		X10_2.X10_2Builder setYField(String yField);
		X10_2.X10_2Builder setZField(String zField);

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

		X10_2.X10_2Builder prune();
	}

	/*********************** Immutable Implementation of X10_2  ***********************/
	class X10_2Impl implements X10_2 {
		private final String yField;
		private final String zField;
		
		protected X10_2Impl(X10_2.X10_2Builder builder) {
			this.yField = builder.getYField();
			this.zField = builder.getZField();
		}
		
		@Override
		@RosettaAttribute("yField")
		public String getYField() {
			return yField;
		}
		
		@Override
		@RosettaAttribute("zField")
		public String getZField() {
			return zField;
		}
		
		@Override
		public X10_2 build() {
			return this;
		}
		
		@Override
		public X10_2.X10_2Builder toBuilder() {
			X10_2.X10_2Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(X10_2.X10_2Builder builder) {
			ofNullable(getYField()).ifPresent(builder::setYField);
			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;
		
			X10_2 _that = getType().cast(o);
		
			if (!Objects.equals(yField, _that.getYField())) return false;
			if (!Objects.equals(zField, _that.getZField())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (yField != null ? yField.hashCode() : 0);
			_result = 31 * _result + (zField != null ? zField.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "X10_2 {" +
				"yField=" + this.yField + ", " +
				"zField=" + this.zField +
			'}';
		}
	}

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy