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

com.rosetta.teststruct.model.Top12c Maven / Gradle / Ivy

There is a newer version: 11.25.1
Show newest version
package com.rosetta.teststruct.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.teststruct.model.Top12c;
import com.rosetta.teststruct.model.Top12c.Top12cBuilder;
import com.rosetta.teststruct.model.Top12c.Top12cBuilderImpl;
import com.rosetta.teststruct.model.Top12c.Top12cImpl;
import com.rosetta.teststruct.model.meta.Top12cMeta;
import java.util.Objects;

import static java.util.Optional.ofNullable;

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

	Top12cMeta metaData = new Top12cMeta();

	/*********************** Getter Methods  ***********************/
	String getAField();
	String getBField();
	String getCField();

	/*********************** Build Methods  ***********************/
	Top12c build();
	
	Top12c.Top12cBuilder toBuilder();
	
	static Top12c.Top12cBuilder builder() {
		return new Top12c.Top12cBuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return Top12c.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processor.processBasic(path.newSubPath("aField"), String.class, getAField(), this);
		processor.processBasic(path.newSubPath("bField"), String.class, getBField(), this);
		processor.processBasic(path.newSubPath("cField"), String.class, getCField(), this);
	}
	

	/*********************** Builder Interface  ***********************/
	interface Top12cBuilder extends Top12c, RosettaModelObjectBuilder {
		Top12c.Top12cBuilder setAField(String aField);
		Top12c.Top12cBuilder setBField(String bField);
		Top12c.Top12cBuilder setCField(String cField);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processor.processBasic(path.newSubPath("aField"), String.class, getAField(), this);
			processor.processBasic(path.newSubPath("bField"), String.class, getBField(), this);
			processor.processBasic(path.newSubPath("cField"), String.class, getCField(), this);
		}
		

		Top12c.Top12cBuilder prune();
	}

	/*********************** Immutable Implementation of Top12c  ***********************/
	class Top12cImpl implements Top12c {
		private final String aField;
		private final String bField;
		private final String cField;
		
		protected Top12cImpl(Top12c.Top12cBuilder builder) {
			this.aField = builder.getAField();
			this.bField = builder.getBField();
			this.cField = builder.getCField();
		}
		
		@Override
		@RosettaAttribute("aField")
		public String getAField() {
			return aField;
		}
		
		@Override
		@RosettaAttribute("bField")
		public String getBField() {
			return bField;
		}
		
		@Override
		@RosettaAttribute("cField")
		public String getCField() {
			return cField;
		}
		
		@Override
		public Top12c build() {
			return this;
		}
		
		@Override
		public Top12c.Top12cBuilder toBuilder() {
			Top12c.Top12cBuilder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(Top12c.Top12cBuilder builder) {
			ofNullable(getAField()).ifPresent(builder::setAField);
			ofNullable(getBField()).ifPresent(builder::setBField);
			ofNullable(getCField()).ifPresent(builder::setCField);
		}

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

	/*********************** Builder Implementation of Top12c  ***********************/
	class Top12cBuilderImpl implements Top12c.Top12cBuilder {
	
		protected String aField;
		protected String bField;
		protected String cField;
	
		public Top12cBuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("aField")
		public String getAField() {
			return aField;
		}
		
		@Override
		@RosettaAttribute("bField")
		public String getBField() {
			return bField;
		}
		
		@Override
		@RosettaAttribute("cField")
		public String getCField() {
			return cField;
		}
		
		@Override
		@RosettaAttribute("aField")
		public Top12c.Top12cBuilder setAField(String aField) {
			this.aField = aField==null?null:aField;
			return this;
		}
		@Override
		@RosettaAttribute("bField")
		public Top12c.Top12cBuilder setBField(String bField) {
			this.bField = bField==null?null:bField;
			return this;
		}
		@Override
		@RosettaAttribute("cField")
		public Top12c.Top12cBuilder setCField(String cField) {
			this.cField = cField==null?null:cField;
			return this;
		}
		
		@Override
		public Top12c build() {
			return new Top12c.Top12cImpl(this);
		}
		
		@Override
		public Top12c.Top12cBuilder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Top12c.Top12cBuilder prune() {
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getAField()!=null) return true;
			if (getBField()!=null) return true;
			if (getCField()!=null) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Top12c.Top12cBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			Top12c.Top12cBuilder o = (Top12c.Top12cBuilder) other;
			
			
			merger.mergeBasic(getAField(), o.getAField(), this::setAField);
			merger.mergeBasic(getBField(), o.getBField(), this::setBField);
			merger.mergeBasic(getCField(), o.getCField(), this::setCField);
			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;
		
			Top12c _that = getType().cast(o);
		
			if (!Objects.equals(aField, _that.getAField())) return false;
			if (!Objects.equals(bField, _that.getBField())) return false;
			if (!Objects.equals(cField, _that.getCField())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (aField != null ? aField.hashCode() : 0);
			_result = 31 * _result + (bField != null ? bField.hashCode() : 0);
			_result = 31 * _result + (cField != null ? cField.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "Top12cBuilder {" +
				"aField=" + this.aField + ", " +
				"bField=" + this.bField + ", " +
				"cField=" + this.cField +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy