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

com.rosetta.teststruct.model.A8 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.A8;
import com.rosetta.teststruct.model.A8.A8Builder;
import com.rosetta.teststruct.model.A8.A8BuilderImpl;
import com.rosetta.teststruct.model.A8.A8Impl;
import com.rosetta.teststruct.model.meta.A8Meta;
import java.util.Objects;

import static java.util.Optional.ofNullable;

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

	A8Meta metaData = new A8Meta();

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

	/*********************** Build Methods  ***********************/
	A8 build();
	
	A8.A8Builder toBuilder();
	
	static A8.A8Builder builder() {
		return new A8.A8BuilderImpl();
	}

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

	/*********************** Builder Interface  ***********************/
	interface A8Builder extends A8, RosettaModelObjectBuilder {
		A8.A8Builder setBField(String bField);

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

		A8.A8Builder prune();
	}

	/*********************** Immutable Implementation of A8  ***********************/
	class A8Impl implements A8 {
		private final String bField;
		
		protected A8Impl(A8.A8Builder builder) {
			this.bField = builder.getBField();
		}
		
		@Override
		@RosettaAttribute("bField")
		public String getBField() {
			return bField;
		}
		
		@Override
		public A8 build() {
			return this;
		}
		
		@Override
		public A8.A8Builder toBuilder() {
			A8.A8Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(A8.A8Builder builder) {
			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;
		
			A8 _that = getType().cast(o);
		
			if (!Objects.equals(bField, _that.getBField())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (bField != null ? bField.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "A8 {" +
				"bField=" + this.bField +
			'}';
		}
	}

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy