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

com.rosetta.testconditional.model.W13 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.W13;
import com.rosetta.testconditional.model.W13.W13Builder;
import com.rosetta.testconditional.model.W13.W13BuilderImpl;
import com.rosetta.testconditional.model.W13.W13Impl;
import com.rosetta.testconditional.model.meta.W13Meta;
import java.util.Objects;

import static java.util.Optional.ofNullable;

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

	W13Meta metaData = new W13Meta();

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

	/*********************** Build Methods  ***********************/
	W13 build();
	
	W13.W13Builder toBuilder();
	
	static W13.W13Builder builder() {
		return new W13.W13BuilderImpl();
	}

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

	/*********************** Builder Interface  ***********************/
	interface W13Builder extends W13, RosettaModelObjectBuilder {
		W13.W13Builder setSField(String sField);
		W13.W13Builder setXField(String xField);

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

		W13.W13Builder prune();
	}

	/*********************** Immutable Implementation of W13  ***********************/
	class W13Impl implements W13 {
		private final String sField;
		private final String xField;
		
		protected W13Impl(W13.W13Builder builder) {
			this.sField = builder.getSField();
			this.xField = builder.getXField();
		}
		
		@Override
		@RosettaAttribute("sField")
		public String getSField() {
			return sField;
		}
		
		@Override
		@RosettaAttribute("xField")
		public String getXField() {
			return xField;
		}
		
		@Override
		public W13 build() {
			return this;
		}
		
		@Override
		public W13.W13Builder toBuilder() {
			W13.W13Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(W13.W13Builder builder) {
			ofNullable(getSField()).ifPresent(builder::setSField);
			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;
		
			W13 _that = getType().cast(o);
		
			if (!Objects.equals(sField, _that.getSField())) return false;
			if (!Objects.equals(xField, _that.getXField())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (sField != null ? sField.hashCode() : 0);
			_result = 31 * _result + (xField != null ? xField.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "W13 {" +
				"sField=" + this.sField + ", " +
				"xField=" + this.xField +
			'}';
		}
	}

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy