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

com.rosetta.jptoneofconditional.model.BranchOne Maven / Gradle / Ivy

There is a newer version: 11.25.1
Show newest version
package com.rosetta.jptoneofconditional.model;

import com.rosetta.jptoneofconditional.model.BranchOne;
import com.rosetta.jptoneofconditional.model.BranchOne.BranchOneBuilder;
import com.rosetta.jptoneofconditional.model.BranchOne.BranchOneBuilderImpl;
import com.rosetta.jptoneofconditional.model.BranchOne.BranchOneImpl;
import com.rosetta.jptoneofconditional.model.meta.BranchOneMeta;
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 java.util.Objects;

import static java.util.Optional.ofNullable;

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

	BranchOneMeta metaData = new BranchOneMeta();

	/*********************** Getter Methods  ***********************/
	Boolean getBOneField();

	/*********************** Build Methods  ***********************/
	BranchOne build();
	
	BranchOne.BranchOneBuilder toBuilder();
	
	static BranchOne.BranchOneBuilder builder() {
		return new BranchOne.BranchOneBuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return BranchOne.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processor.processBasic(path.newSubPath("bOneField"), Boolean.class, getBOneField(), this);
	}
	

	/*********************** Builder Interface  ***********************/
	interface BranchOneBuilder extends BranchOne, RosettaModelObjectBuilder {
		BranchOne.BranchOneBuilder setBOneField(Boolean bOneField);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processor.processBasic(path.newSubPath("bOneField"), Boolean.class, getBOneField(), this);
		}
		

		BranchOne.BranchOneBuilder prune();
	}

	/*********************** Immutable Implementation of BranchOne  ***********************/
	class BranchOneImpl implements BranchOne {
		private final Boolean bOneField;
		
		protected BranchOneImpl(BranchOne.BranchOneBuilder builder) {
			this.bOneField = builder.getBOneField();
		}
		
		@Override
		@RosettaAttribute("bOneField")
		public Boolean getBOneField() {
			return bOneField;
		}
		
		@Override
		public BranchOne build() {
			return this;
		}
		
		@Override
		public BranchOne.BranchOneBuilder toBuilder() {
			BranchOne.BranchOneBuilder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(BranchOne.BranchOneBuilder builder) {
			ofNullable(getBOneField()).ifPresent(builder::setBOneField);
		}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy