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

com.rosetta.testhard.model.B3 Maven / Gradle / Ivy

There is a newer version: 11.25.1
Show newest version
package com.rosetta.testhard.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.testhard.model.B3;
import com.rosetta.testhard.model.B3.B3Builder;
import com.rosetta.testhard.model.B3.B3BuilderImpl;
import com.rosetta.testhard.model.B3.B3Impl;
import com.rosetta.testhard.model.meta.B3Meta;
import java.util.Objects;

import static java.util.Optional.ofNullable;

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

	B3Meta metaData = new B3Meta();

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

	/*********************** Build Methods  ***********************/
	B3 build();
	
	B3.B3Builder toBuilder();
	
	static B3.B3Builder builder() {
		return new B3.B3BuilderImpl();
	}

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

	/*********************** Builder Interface  ***********************/
	interface B3Builder extends B3, RosettaModelObjectBuilder {
		B3.B3Builder setCfield(String cfield);

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

		B3.B3Builder prune();
	}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy