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

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

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

import com.rosetta.mappingprocessortest.model.X7;
import com.rosetta.mappingprocessortest.model.X7.X7Builder;
import com.rosetta.mappingprocessortest.model.X7.X7BuilderImpl;
import com.rosetta.mappingprocessortest.model.X7.X7Impl;
import com.rosetta.mappingprocessortest.model.meta.X7Meta;
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="X7", builder=X7.X7BuilderImpl.class, version="test")
public interface X7 extends RosettaModelObject {

	X7Meta metaData = new X7Meta();

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

	/*********************** Build Methods  ***********************/
	X7 build();
	
	X7.X7Builder toBuilder();
	
	static X7.X7Builder builder() {
		return new X7.X7BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return X7.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 X7Builder extends X7, RosettaModelObjectBuilder {
		X7.X7Builder setStr1Field(String str1Field);
		X7.X7Builder setStr2Field(String str2Field);
		X7.X7Builder 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);
		}
		

		X7.X7Builder prune();
	}

	/*********************** Immutable Implementation of X7  ***********************/
	class X7Impl implements X7 {
		private final String str1Field;
		private final String str2Field;
		private final String str3Field;
		
		protected X7Impl(X7.X7Builder 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 X7 build() {
			return this;
		}
		
		@Override
		public X7.X7Builder toBuilder() {
			X7.X7Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(X7.X7Builder 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;
		
			X7 _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 "X7 {" +
				"str1Field=" + this.str1Field + ", " +
				"str2Field=" + this.str2Field + ", " +
				"str3Field=" + this.str3Field +
			'}';
		}
	}

	/*********************** Builder Implementation of X7  ***********************/
	class X7BuilderImpl implements X7.X7Builder {
	
		protected String str1Field;
		protected String str2Field;
		protected String str3Field;
	
		public X7BuilderImpl() {
		}
	
		@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 X7.X7Builder setStr1Field(String str1Field) {
			this.str1Field = str1Field==null?null:str1Field;
			return this;
		}
		@Override
		@RosettaAttribute("str2Field")
		public X7.X7Builder setStr2Field(String str2Field) {
			this.str2Field = str2Field==null?null:str2Field;
			return this;
		}
		@Override
		@RosettaAttribute("str3Field")
		public X7.X7Builder setStr3Field(String str3Field) {
			this.str3Field = str3Field==null?null:str3Field;
			return this;
		}
		
		@Override
		public X7 build() {
			return new X7.X7Impl(this);
		}
		
		@Override
		public X7.X7Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public X7.X7Builder 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 X7.X7Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			X7.X7Builder o = (X7.X7Builder) 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;
		
			X7 _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 "X7Builder {" +
				"str1Field=" + this.str1Field + ", " +
				"str2Field=" + this.str2Field + ", " +
				"str3Field=" + this.str3Field +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy