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

com.rosetta.mappingprocessortest.model.X8 Maven / Gradle / Ivy

There is a newer version: 11.25.1
Show newest version
package com.rosetta.mappingprocessortest.model;

import com.rosetta.mappingprocessortest.model.X8;
import com.rosetta.mappingprocessortest.model.X8.X8Builder;
import com.rosetta.mappingprocessortest.model.X8.X8BuilderImpl;
import com.rosetta.mappingprocessortest.model.X8.X8Impl;
import com.rosetta.mappingprocessortest.model.meta.X8Meta;
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 java.util.Objects;

import static java.util.Optional.ofNullable;

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

	X8Meta metaData = new X8Meta();

	/*********************** Getter Methods  ***********************/
	String getStr1Field();
	String getStr2Field();
	String getStr3Field();

	/*********************** Build Methods  ***********************/
	X8 build();
	
	X8.X8Builder toBuilder();
	
	static X8.X8Builder builder() {
		return new X8.X8BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return X8.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processor.processBasic(path.newSubPath("str1Field"), String.class, getStr1Field(), this);
		processor.processBasic(path.newSubPath("str2Field"), String.class, getStr2Field(), this);
		processor.processBasic(path.newSubPath("str3Field"), String.class, getStr3Field(), this);
	}
	

	/*********************** Builder Interface  ***********************/
	interface X8Builder extends X8, RosettaModelObjectBuilder {
		X8.X8Builder setStr1Field(String str1Field);
		X8.X8Builder setStr2Field(String str2Field);
		X8.X8Builder setStr3Field(String str3Field);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processor.processBasic(path.newSubPath("str1Field"), String.class, getStr1Field(), this);
			processor.processBasic(path.newSubPath("str2Field"), String.class, getStr2Field(), this);
			processor.processBasic(path.newSubPath("str3Field"), String.class, getStr3Field(), this);
		}
		

		X8.X8Builder prune();
	}

	/*********************** Immutable Implementation of X8  ***********************/
	class X8Impl implements X8 {
		private final String str1Field;
		private final String str2Field;
		private final String str3Field;
		
		protected X8Impl(X8.X8Builder builder) {
			this.str1Field = builder.getStr1Field();
			this.str2Field = builder.getStr2Field();
			this.str3Field = builder.getStr3Field();
		}
		
		@Override
		@RosettaAttribute("str1Field")
		public String getStr1Field() {
			return str1Field;
		}
		
		@Override
		@RosettaAttribute("str2Field")
		public String getStr2Field() {
			return str2Field;
		}
		
		@Override
		@RosettaAttribute("str3Field")
		public String getStr3Field() {
			return str3Field;
		}
		
		@Override
		public X8 build() {
			return this;
		}
		
		@Override
		public X8.X8Builder toBuilder() {
			X8.X8Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(X8.X8Builder builder) {
			ofNullable(getStr1Field()).ifPresent(builder::setStr1Field);
			ofNullable(getStr2Field()).ifPresent(builder::setStr2Field);
			ofNullable(getStr3Field()).ifPresent(builder::setStr3Field);
		}

		@Override
		public boolean equals(Object o) {
			if (this == o) return true;
			if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
		
			X8 _that = getType().cast(o);
		
			if (!Objects.equals(str1Field, _that.getStr1Field())) return false;
			if (!Objects.equals(str2Field, _that.getStr2Field())) return false;
			if (!Objects.equals(str3Field, _that.getStr3Field())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (str1Field != null ? str1Field.hashCode() : 0);
			_result = 31 * _result + (str2Field != null ? str2Field.hashCode() : 0);
			_result = 31 * _result + (str3Field != null ? str3Field.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "X8 {" +
				"str1Field=" + this.str1Field + ", " +
				"str2Field=" + this.str2Field + ", " +
				"str3Field=" + this.str3Field +
			'}';
		}
	}

	/*********************** Builder Implementation of X8  ***********************/
	class X8BuilderImpl implements X8.X8Builder {
	
		protected String str1Field;
		protected String str2Field;
		protected String str3Field;
	
		public X8BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("str1Field")
		public String getStr1Field() {
			return str1Field;
		}
		
		@Override
		@RosettaAttribute("str2Field")
		public String getStr2Field() {
			return str2Field;
		}
		
		@Override
		@RosettaAttribute("str3Field")
		public String getStr3Field() {
			return str3Field;
		}
		
		@Override
		@RosettaAttribute("str1Field")
		public X8.X8Builder setStr1Field(String str1Field) {
			this.str1Field = str1Field==null?null:str1Field;
			return this;
		}
		@Override
		@RosettaAttribute("str2Field")
		public X8.X8Builder setStr2Field(String str2Field) {
			this.str2Field = str2Field==null?null:str2Field;
			return this;
		}
		@Override
		@RosettaAttribute("str3Field")
		public X8.X8Builder setStr3Field(String str3Field) {
			this.str3Field = str3Field==null?null:str3Field;
			return this;
		}
		
		@Override
		public X8 build() {
			return new X8.X8Impl(this);
		}
		
		@Override
		public X8.X8Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public X8.X8Builder prune() {
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getStr1Field()!=null) return true;
			if (getStr2Field()!=null) return true;
			if (getStr3Field()!=null) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public X8.X8Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			X8.X8Builder o = (X8.X8Builder) other;
			
			
			merger.mergeBasic(getStr1Field(), o.getStr1Field(), this::setStr1Field);
			merger.mergeBasic(getStr2Field(), o.getStr2Field(), this::setStr2Field);
			merger.mergeBasic(getStr3Field(), o.getStr3Field(), this::setStr3Field);
			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;
		
			X8 _that = getType().cast(o);
		
			if (!Objects.equals(str1Field, _that.getStr1Field())) return false;
			if (!Objects.equals(str2Field, _that.getStr2Field())) return false;
			if (!Objects.equals(str3Field, _that.getStr3Field())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (str1Field != null ? str1Field.hashCode() : 0);
			_result = 31 * _result + (str2Field != null ? str2Field.hashCode() : 0);
			_result = 31 * _result + (str3Field != null ? str3Field.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "X8Builder {" +
				"str1Field=" + this.str1Field + ", " +
				"str2Field=" + this.str2Field + ", " +
				"str3Field=" + this.str3Field +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy