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

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

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

import com.rosetta.mappingprocessortest.model.Y9;
import com.rosetta.mappingprocessortest.model.Y9.Y9Builder;
import com.rosetta.mappingprocessortest.model.Y9.Y9BuilderImpl;
import com.rosetta.mappingprocessortest.model.Y9.Y9Impl;
import com.rosetta.mappingprocessortest.model.meta.Y9Meta;
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="Y9", builder=Y9.Y9BuilderImpl.class, version="test")
public interface Y9 extends RosettaModelObject {

	Y9Meta metaData = new Y9Meta();

	/*********************** Getter Methods  ***********************/
	String getStrField();

	/*********************** Build Methods  ***********************/
	Y9 build();
	
	Y9.Y9Builder toBuilder();
	
	static Y9.Y9Builder builder() {
		return new Y9.Y9BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return Y9.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processor.processBasic(path.newSubPath("strField"), String.class, getStrField(), this);
	}
	

	/*********************** Builder Interface  ***********************/
	interface Y9Builder extends Y9, RosettaModelObjectBuilder {
		Y9.Y9Builder setStrField(String strField);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processor.processBasic(path.newSubPath("strField"), String.class, getStrField(), this);
		}
		

		Y9.Y9Builder prune();
	}

	/*********************** Immutable Implementation of Y9  ***********************/
	class Y9Impl implements Y9 {
		private final String strField;
		
		protected Y9Impl(Y9.Y9Builder builder) {
			this.strField = builder.getStrField();
		}
		
		@Override
		@RosettaAttribute("strField")
		public String getStrField() {
			return strField;
		}
		
		@Override
		public Y9 build() {
			return this;
		}
		
		@Override
		public Y9.Y9Builder toBuilder() {
			Y9.Y9Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(Y9.Y9Builder builder) {
			ofNullable(getStrField()).ifPresent(builder::setStrField);
		}

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

	/*********************** Builder Implementation of Y9  ***********************/
	class Y9BuilderImpl implements Y9.Y9Builder {
	
		protected String strField;
	
		public Y9BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("strField")
		public String getStrField() {
			return strField;
		}
		
		@Override
		@RosettaAttribute("strField")
		public Y9.Y9Builder setStrField(String strField) {
			this.strField = strField==null?null:strField;
			return this;
		}
		
		@Override
		public Y9 build() {
			return new Y9.Y9Impl(this);
		}
		
		@Override
		public Y9.Y9Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Y9.Y9Builder prune() {
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getStrField()!=null) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Y9.Y9Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			Y9.Y9Builder o = (Y9.Y9Builder) other;
			
			
			merger.mergeBasic(getStrField(), o.getStrField(), this::setStrField);
			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;
		
			Y9 _that = getType().cast(o);
		
			if (!Objects.equals(strField, _that.getStrField())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (strField != null ? strField.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "Y9Builder {" +
				"strField=" + this.strField +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy