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

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

There is a newer version: 11.31.0
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.Top12;
import com.rosetta.teststruct.model.Top12.Top12Builder;
import com.rosetta.teststruct.model.Top12.Top12BuilderImpl;
import com.rosetta.teststruct.model.Top12.Top12Impl;
import com.rosetta.teststruct.model.meta.Top12Meta;
import java.util.Objects;

import static java.util.Optional.ofNullable;

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

	Top12Meta metaData = new Top12Meta();

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

	/*********************** Build Methods  ***********************/
	Top12 build();
	
	Top12.Top12Builder toBuilder();
	
	static Top12.Top12Builder builder() {
		return new Top12.Top12BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return Top12.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);
	}
	

	/*********************** Builder Interface  ***********************/
	interface Top12Builder extends Top12, RosettaModelObjectBuilder {
		Top12.Top12Builder setAField(String aField);
		Top12.Top12Builder setBField(String bField);

		@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);
		}
		

		Top12.Top12Builder prune();
	}

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

		@Override
		public boolean equals(Object o) {
			if (this == o) return true;
			if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
		
			Top12 _that = getType().cast(o);
		
			if (!Objects.equals(aField, _that.getAField())) return false;
			if (!Objects.equals(bField, _that.getBField())) 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);
			return _result;
		}
		
		@Override
		public String toString() {
			return "Top12 {" +
				"aField=" + this.aField + ", " +
				"bField=" + this.bField +
			'}';
		}
	}

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy