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

com.rosetta.testconditional.model.D22 Maven / Gradle / Ivy

There is a newer version: 11.25.1
Show newest version
package com.rosetta.testconditional.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.testconditional.model.D22;
import com.rosetta.testconditional.model.D22.D22Builder;
import com.rosetta.testconditional.model.D22.D22BuilderImpl;
import com.rosetta.testconditional.model.D22.D22Impl;
import com.rosetta.testconditional.model.meta.D22Meta;
import java.util.Objects;

import static java.util.Optional.ofNullable;

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

	D22Meta metaData = new D22Meta();

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

	/*********************** Build Methods  ***********************/
	D22 build();
	
	D22.D22Builder toBuilder();
	
	static D22.D22Builder builder() {
		return new D22.D22BuilderImpl();
	}

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

	/*********************** Builder Interface  ***********************/
	interface D22Builder extends D22, RosettaModelObjectBuilder {
		D22.D22Builder setVal(String val);

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

		D22.D22Builder prune();
	}

	/*********************** Immutable Implementation of D22  ***********************/
	class D22Impl implements D22 {
		private final String val;
		
		protected D22Impl(D22.D22Builder builder) {
			this.val = builder.getVal();
		}
		
		@Override
		@RosettaAttribute("val")
		public String getVal() {
			return val;
		}
		
		@Override
		public D22 build() {
			return this;
		}
		
		@Override
		public D22.D22Builder toBuilder() {
			D22.D22Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(D22.D22Builder builder) {
			ofNullable(getVal()).ifPresent(builder::setVal);
		}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy