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

com.rosetta.jptlegalagreement.model.RegimeTerms Maven / Gradle / Ivy

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

import com.rosetta.jptlegalagreement.model.AdditionalTypeEnum;
import com.rosetta.jptlegalagreement.model.RegimeTerms;
import com.rosetta.jptlegalagreement.model.RegimeTerms.RegimeTermsBuilder;
import com.rosetta.jptlegalagreement.model.RegimeTerms.RegimeTermsBuilderImpl;
import com.rosetta.jptlegalagreement.model.RegimeTerms.RegimeTermsImpl;
import com.rosetta.jptlegalagreement.model.SimmException;
import com.rosetta.jptlegalagreement.model.meta.RegimeTermsMeta;
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="RegimeTerms", builder=RegimeTerms.RegimeTermsBuilderImpl.class, version="test")
public interface RegimeTerms extends RosettaModelObject {

	RegimeTermsMeta metaData = new RegimeTermsMeta();

	/*********************** Getter Methods  ***********************/
	Boolean getIsApplicable();
	SimmException getSimmException();
	Boolean getRetrospectiveEffect();
	AdditionalTypeEnum getAdditionalType();

	/*********************** Build Methods  ***********************/
	RegimeTerms build();
	
	RegimeTerms.RegimeTermsBuilder toBuilder();
	
	static RegimeTerms.RegimeTermsBuilder builder() {
		return new RegimeTerms.RegimeTermsBuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return RegimeTerms.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processor.processBasic(path.newSubPath("isApplicable"), Boolean.class, getIsApplicable(), this);
		processRosetta(path.newSubPath("simmException"), processor, SimmException.class, getSimmException());
		processor.processBasic(path.newSubPath("retrospectiveEffect"), Boolean.class, getRetrospectiveEffect(), this);
		processor.processBasic(path.newSubPath("additionalType"), AdditionalTypeEnum.class, getAdditionalType(), this);
	}
	

	/*********************** Builder Interface  ***********************/
	interface RegimeTermsBuilder extends RegimeTerms, RosettaModelObjectBuilder {
		SimmException.SimmExceptionBuilder getOrCreateSimmException();
		SimmException.SimmExceptionBuilder getSimmException();
		RegimeTerms.RegimeTermsBuilder setIsApplicable(Boolean isApplicable);
		RegimeTerms.RegimeTermsBuilder setSimmException(SimmException simmException);
		RegimeTerms.RegimeTermsBuilder setRetrospectiveEffect(Boolean retrospectiveEffect);
		RegimeTerms.RegimeTermsBuilder setAdditionalType(AdditionalTypeEnum additionalType);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processor.processBasic(path.newSubPath("isApplicable"), Boolean.class, getIsApplicable(), this);
			processRosetta(path.newSubPath("simmException"), processor, SimmException.SimmExceptionBuilder.class, getSimmException());
			processor.processBasic(path.newSubPath("retrospectiveEffect"), Boolean.class, getRetrospectiveEffect(), this);
			processor.processBasic(path.newSubPath("additionalType"), AdditionalTypeEnum.class, getAdditionalType(), this);
		}
		

		RegimeTerms.RegimeTermsBuilder prune();
	}

	/*********************** Immutable Implementation of RegimeTerms  ***********************/
	class RegimeTermsImpl implements RegimeTerms {
		private final Boolean isApplicable;
		private final SimmException simmException;
		private final Boolean retrospectiveEffect;
		private final AdditionalTypeEnum additionalType;
		
		protected RegimeTermsImpl(RegimeTerms.RegimeTermsBuilder builder) {
			this.isApplicable = builder.getIsApplicable();
			this.simmException = ofNullable(builder.getSimmException()).map(f->f.build()).orElse(null);
			this.retrospectiveEffect = builder.getRetrospectiveEffect();
			this.additionalType = builder.getAdditionalType();
		}
		
		@Override
		@RosettaAttribute("isApplicable")
		public Boolean getIsApplicable() {
			return isApplicable;
		}
		
		@Override
		@RosettaAttribute("simmException")
		public SimmException getSimmException() {
			return simmException;
		}
		
		@Override
		@RosettaAttribute("retrospectiveEffect")
		public Boolean getRetrospectiveEffect() {
			return retrospectiveEffect;
		}
		
		@Override
		@RosettaAttribute("additionalType")
		public AdditionalTypeEnum getAdditionalType() {
			return additionalType;
		}
		
		@Override
		public RegimeTerms build() {
			return this;
		}
		
		@Override
		public RegimeTerms.RegimeTermsBuilder toBuilder() {
			RegimeTerms.RegimeTermsBuilder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(RegimeTerms.RegimeTermsBuilder builder) {
			ofNullable(getIsApplicable()).ifPresent(builder::setIsApplicable);
			ofNullable(getSimmException()).ifPresent(builder::setSimmException);
			ofNullable(getRetrospectiveEffect()).ifPresent(builder::setRetrospectiveEffect);
			ofNullable(getAdditionalType()).ifPresent(builder::setAdditionalType);
		}

		@Override
		public boolean equals(Object o) {
			if (this == o) return true;
			if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
		
			RegimeTerms _that = getType().cast(o);
		
			if (!Objects.equals(isApplicable, _that.getIsApplicable())) return false;
			if (!Objects.equals(simmException, _that.getSimmException())) return false;
			if (!Objects.equals(retrospectiveEffect, _that.getRetrospectiveEffect())) return false;
			if (!Objects.equals(additionalType, _that.getAdditionalType())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (isApplicable != null ? isApplicable.hashCode() : 0);
			_result = 31 * _result + (simmException != null ? simmException.hashCode() : 0);
			_result = 31 * _result + (retrospectiveEffect != null ? retrospectiveEffect.hashCode() : 0);
			_result = 31 * _result + (additionalType != null ? additionalType.getClass().getName().hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "RegimeTerms {" +
				"isApplicable=" + this.isApplicable + ", " +
				"simmException=" + this.simmException + ", " +
				"retrospectiveEffect=" + this.retrospectiveEffect + ", " +
				"additionalType=" + this.additionalType +
			'}';
		}
	}

	/*********************** Builder Implementation of RegimeTerms  ***********************/
	class RegimeTermsBuilderImpl implements RegimeTerms.RegimeTermsBuilder {
	
		protected Boolean isApplicable;
		protected SimmException.SimmExceptionBuilder simmException;
		protected Boolean retrospectiveEffect;
		protected AdditionalTypeEnum additionalType;
	
		public RegimeTermsBuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("isApplicable")
		public Boolean getIsApplicable() {
			return isApplicable;
		}
		
		@Override
		@RosettaAttribute("simmException")
		public SimmException.SimmExceptionBuilder getSimmException() {
			return simmException;
		}
		
		@Override
		public SimmException.SimmExceptionBuilder getOrCreateSimmException() {
			SimmException.SimmExceptionBuilder result;
			if (simmException!=null) {
				result = simmException;
			}
			else {
				result = simmException = SimmException.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("retrospectiveEffect")
		public Boolean getRetrospectiveEffect() {
			return retrospectiveEffect;
		}
		
		@Override
		@RosettaAttribute("additionalType")
		public AdditionalTypeEnum getAdditionalType() {
			return additionalType;
		}
		
		@Override
		@RosettaAttribute("isApplicable")
		public RegimeTerms.RegimeTermsBuilder setIsApplicable(Boolean isApplicable) {
			this.isApplicable = isApplicable==null?null:isApplicable;
			return this;
		}
		@Override
		@RosettaAttribute("simmException")
		public RegimeTerms.RegimeTermsBuilder setSimmException(SimmException simmException) {
			this.simmException = simmException==null?null:simmException.toBuilder();
			return this;
		}
		@Override
		@RosettaAttribute("retrospectiveEffect")
		public RegimeTerms.RegimeTermsBuilder setRetrospectiveEffect(Boolean retrospectiveEffect) {
			this.retrospectiveEffect = retrospectiveEffect==null?null:retrospectiveEffect;
			return this;
		}
		@Override
		@RosettaAttribute("additionalType")
		public RegimeTerms.RegimeTermsBuilder setAdditionalType(AdditionalTypeEnum additionalType) {
			this.additionalType = additionalType==null?null:additionalType;
			return this;
		}
		
		@Override
		public RegimeTerms build() {
			return new RegimeTerms.RegimeTermsImpl(this);
		}
		
		@Override
		public RegimeTerms.RegimeTermsBuilder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public RegimeTerms.RegimeTermsBuilder prune() {
			if (simmException!=null && !simmException.prune().hasData()) simmException = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getIsApplicable()!=null) return true;
			if (getSimmException()!=null && getSimmException().hasData()) return true;
			if (getRetrospectiveEffect()!=null) return true;
			if (getAdditionalType()!=null) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public RegimeTerms.RegimeTermsBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			RegimeTerms.RegimeTermsBuilder o = (RegimeTerms.RegimeTermsBuilder) other;
			
			merger.mergeRosetta(getSimmException(), o.getSimmException(), this::setSimmException);
			
			merger.mergeBasic(getIsApplicable(), o.getIsApplicable(), this::setIsApplicable);
			merger.mergeBasic(getRetrospectiveEffect(), o.getRetrospectiveEffect(), this::setRetrospectiveEffect);
			merger.mergeBasic(getAdditionalType(), o.getAdditionalType(), this::setAdditionalType);
			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;
		
			RegimeTerms _that = getType().cast(o);
		
			if (!Objects.equals(isApplicable, _that.getIsApplicable())) return false;
			if (!Objects.equals(simmException, _that.getSimmException())) return false;
			if (!Objects.equals(retrospectiveEffect, _that.getRetrospectiveEffect())) return false;
			if (!Objects.equals(additionalType, _that.getAdditionalType())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (isApplicable != null ? isApplicable.hashCode() : 0);
			_result = 31 * _result + (simmException != null ? simmException.hashCode() : 0);
			_result = 31 * _result + (retrospectiveEffect != null ? retrospectiveEffect.hashCode() : 0);
			_result = 31 * _result + (additionalType != null ? additionalType.getClass().getName().hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "RegimeTermsBuilder {" +
				"isApplicable=" + this.isApplicable + ", " +
				"simmException=" + this.simmException + ", " +
				"retrospectiveEffect=" + this.retrospectiveEffect + ", " +
				"additionalType=" + this.additionalType +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy