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

com.rosetta.teststruct.model.Top12a 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.Top12a;
import com.rosetta.teststruct.model.Top12a.Top12aBuilder;
import com.rosetta.teststruct.model.Top12a.Top12aBuilderImpl;
import com.rosetta.teststruct.model.Top12a.Top12aImpl;
import com.rosetta.teststruct.model.meta.Top12aMeta;
import java.util.Objects;

import static java.util.Optional.ofNullable;

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

	Top12aMeta metaData = new Top12aMeta();

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

	/*********************** Build Methods  ***********************/
	Top12a build();
	
	Top12a.Top12aBuilder toBuilder();
	
	static Top12a.Top12aBuilder builder() {
		return new Top12a.Top12aBuilderImpl();
	}

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

	/*********************** Builder Interface  ***********************/
	interface Top12aBuilder extends Top12a, RosettaModelObjectBuilder {
		Top12a.Top12aBuilder setAField(String aField);

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

		Top12a.Top12aBuilder prune();
	}

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy