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

com.rosetta.testconditional.model.W18_2 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.W18_2;
import com.rosetta.testconditional.model.W18_2.W18_2Builder;
import com.rosetta.testconditional.model.W18_2.W18_2BuilderImpl;
import com.rosetta.testconditional.model.W18_2.W18_2Impl;
import com.rosetta.testconditional.model.meta.W18_2Meta;
import java.util.Objects;

import static java.util.Optional.ofNullable;

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

	W18_2Meta metaData = new W18_2Meta();

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

	/*********************** Build Methods  ***********************/
	W18_2 build();
	
	W18_2.W18_2Builder toBuilder();
	
	static W18_2.W18_2Builder builder() {
		return new W18_2.W18_2BuilderImpl();
	}

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

	/*********************** Builder Interface  ***********************/
	interface W18_2Builder extends W18_2, RosettaModelObjectBuilder {
		W18_2.W18_2Builder setXField(String xField);
		W18_2.W18_2Builder setYField(String yField);

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

		W18_2.W18_2Builder prune();
	}

	/*********************** Immutable Implementation of W18_2  ***********************/
	class W18_2Impl implements W18_2 {
		private final String xField;
		private final String yField;
		
		protected W18_2Impl(W18_2.W18_2Builder builder) {
			this.xField = builder.getXField();
			this.yField = builder.getYField();
		}
		
		@Override
		@RosettaAttribute("xField")
		public String getXField() {
			return xField;
		}
		
		@Override
		@RosettaAttribute("yField")
		public String getYField() {
			return yField;
		}
		
		@Override
		public W18_2 build() {
			return this;
		}
		
		@Override
		public W18_2.W18_2Builder toBuilder() {
			W18_2.W18_2Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(W18_2.W18_2Builder builder) {
			ofNullable(getXField()).ifPresent(builder::setXField);
			ofNullable(getYField()).ifPresent(builder::setYField);
		}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy