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

com.rosetta.test.conditionfunc.model.Z3 Maven / Gradle / Ivy

There is a newer version: 11.25.1
Show newest version
package com.rosetta.test.conditionfunc.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.test.conditionfunc.model.Z3;
import com.rosetta.test.conditionfunc.model.Z3.Z3Builder;
import com.rosetta.test.conditionfunc.model.Z3.Z3BuilderImpl;
import com.rosetta.test.conditionfunc.model.Z3.Z3Impl;
import com.rosetta.test.conditionfunc.model.meta.Z3Meta;
import java.util.Objects;

import static java.util.Optional.ofNullable;

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

	Z3Meta metaData = new Z3Meta();

	/*********************** Getter Methods  ***********************/
	String getStr1Field();
	String getStr2Field();

	/*********************** Build Methods  ***********************/
	Z3 build();
	
	Z3.Z3Builder toBuilder();
	
	static Z3.Z3Builder builder() {
		return new Z3.Z3BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return Z3.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processor.processBasic(path.newSubPath("str1Field"), String.class, getStr1Field(), this);
		processor.processBasic(path.newSubPath("str2Field"), String.class, getStr2Field(), this);
	}
	

	/*********************** Builder Interface  ***********************/
	interface Z3Builder extends Z3, RosettaModelObjectBuilder {
		Z3.Z3Builder setStr1Field(String str1Field);
		Z3.Z3Builder setStr2Field(String str2Field);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processor.processBasic(path.newSubPath("str1Field"), String.class, getStr1Field(), this);
			processor.processBasic(path.newSubPath("str2Field"), String.class, getStr2Field(), this);
		}
		

		Z3.Z3Builder prune();
	}

	/*********************** Immutable Implementation of Z3  ***********************/
	class Z3Impl implements Z3 {
		private final String str1Field;
		private final String str2Field;
		
		protected Z3Impl(Z3.Z3Builder builder) {
			this.str1Field = builder.getStr1Field();
			this.str2Field = builder.getStr2Field();
		}
		
		@Override
		@RosettaAttribute("str1Field")
		public String getStr1Field() {
			return str1Field;
		}
		
		@Override
		@RosettaAttribute("str2Field")
		public String getStr2Field() {
			return str2Field;
		}
		
		@Override
		public Z3 build() {
			return this;
		}
		
		@Override
		public Z3.Z3Builder toBuilder() {
			Z3.Z3Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(Z3.Z3Builder builder) {
			ofNullable(getStr1Field()).ifPresent(builder::setStr1Field);
			ofNullable(getStr2Field()).ifPresent(builder::setStr2Field);
		}

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

	/*********************** Builder Implementation of Z3  ***********************/
	class Z3BuilderImpl implements Z3.Z3Builder {
	
		protected String str1Field;
		protected String str2Field;
	
		public Z3BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("str1Field")
		public String getStr1Field() {
			return str1Field;
		}
		
		@Override
		@RosettaAttribute("str2Field")
		public String getStr2Field() {
			return str2Field;
		}
		
		@Override
		@RosettaAttribute("str1Field")
		public Z3.Z3Builder setStr1Field(String str1Field) {
			this.str1Field = str1Field==null?null:str1Field;
			return this;
		}
		@Override
		@RosettaAttribute("str2Field")
		public Z3.Z3Builder setStr2Field(String str2Field) {
			this.str2Field = str2Field==null?null:str2Field;
			return this;
		}
		
		@Override
		public Z3 build() {
			return new Z3.Z3Impl(this);
		}
		
		@Override
		public Z3.Z3Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Z3.Z3Builder prune() {
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getStr1Field()!=null) return true;
			if (getStr2Field()!=null) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Z3.Z3Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			Z3.Z3Builder o = (Z3.Z3Builder) other;
			
			
			merger.mergeBasic(getStr1Field(), o.getStr1Field(), this::setStr1Field);
			merger.mergeBasic(getStr2Field(), o.getStr2Field(), this::setStr2Field);
			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;
		
			Z3 _that = getType().cast(o);
		
			if (!Objects.equals(str1Field, _that.getStr1Field())) return false;
			if (!Objects.equals(str2Field, _that.getStr2Field())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (str1Field != null ? str1Field.hashCode() : 0);
			_result = 31 * _result + (str2Field != null ? str2Field.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "Z3Builder {" +
				"str1Field=" + this.str1Field + ", " +
				"str2Field=" + this.str2Field +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy