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

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

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

import com.rosetta.jptlegalagreement.model.AmendmentEffectiveDate;
import com.rosetta.jptlegalagreement.model.AmendmentEffectiveDate.AmendmentEffectiveDateBuilder;
import com.rosetta.jptlegalagreement.model.AmendmentEffectiveDate.AmendmentEffectiveDateBuilderImpl;
import com.rosetta.jptlegalagreement.model.AmendmentEffectiveDate.AmendmentEffectiveDateImpl;
import com.rosetta.jptlegalagreement.model.AmendmentEffectiveDateEnum;
import com.rosetta.jptlegalagreement.model.meta.AmendmentEffectiveDateMeta;
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.model.lib.records.Date;
import java.util.Objects;

import static java.util.Optional.ofNullable;

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

	AmendmentEffectiveDateMeta metaData = new AmendmentEffectiveDateMeta();

	/*********************** Getter Methods  ***********************/
	Date getDate();
	AmendmentEffectiveDateEnum getSpecificDate();
	String getCustomProvision();

	/*********************** Build Methods  ***********************/
	AmendmentEffectiveDate build();
	
	AmendmentEffectiveDate.AmendmentEffectiveDateBuilder toBuilder();
	
	static AmendmentEffectiveDate.AmendmentEffectiveDateBuilder builder() {
		return new AmendmentEffectiveDate.AmendmentEffectiveDateBuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return AmendmentEffectiveDate.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processor.processBasic(path.newSubPath("date"), Date.class, getDate(), this);
		processor.processBasic(path.newSubPath("specificDate"), AmendmentEffectiveDateEnum.class, getSpecificDate(), this);
		processor.processBasic(path.newSubPath("customProvision"), String.class, getCustomProvision(), this);
	}
	

	/*********************** Builder Interface  ***********************/
	interface AmendmentEffectiveDateBuilder extends AmendmentEffectiveDate, RosettaModelObjectBuilder {
		AmendmentEffectiveDate.AmendmentEffectiveDateBuilder setDate(Date date);
		AmendmentEffectiveDate.AmendmentEffectiveDateBuilder setSpecificDate(AmendmentEffectiveDateEnum specificDate);
		AmendmentEffectiveDate.AmendmentEffectiveDateBuilder setCustomProvision(String customProvision);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processor.processBasic(path.newSubPath("date"), Date.class, getDate(), this);
			processor.processBasic(path.newSubPath("specificDate"), AmendmentEffectiveDateEnum.class, getSpecificDate(), this);
			processor.processBasic(path.newSubPath("customProvision"), String.class, getCustomProvision(), this);
		}
		

		AmendmentEffectiveDate.AmendmentEffectiveDateBuilder prune();
	}

	/*********************** Immutable Implementation of AmendmentEffectiveDate  ***********************/
	class AmendmentEffectiveDateImpl implements AmendmentEffectiveDate {
		private final Date date;
		private final AmendmentEffectiveDateEnum specificDate;
		private final String customProvision;
		
		protected AmendmentEffectiveDateImpl(AmendmentEffectiveDate.AmendmentEffectiveDateBuilder builder) {
			this.date = builder.getDate();
			this.specificDate = builder.getSpecificDate();
			this.customProvision = builder.getCustomProvision();
		}
		
		@Override
		@RosettaAttribute("date")
		public Date getDate() {
			return date;
		}
		
		@Override
		@RosettaAttribute("specificDate")
		public AmendmentEffectiveDateEnum getSpecificDate() {
			return specificDate;
		}
		
		@Override
		@RosettaAttribute("customProvision")
		public String getCustomProvision() {
			return customProvision;
		}
		
		@Override
		public AmendmentEffectiveDate build() {
			return this;
		}
		
		@Override
		public AmendmentEffectiveDate.AmendmentEffectiveDateBuilder toBuilder() {
			AmendmentEffectiveDate.AmendmentEffectiveDateBuilder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(AmendmentEffectiveDate.AmendmentEffectiveDateBuilder builder) {
			ofNullable(getDate()).ifPresent(builder::setDate);
			ofNullable(getSpecificDate()).ifPresent(builder::setSpecificDate);
			ofNullable(getCustomProvision()).ifPresent(builder::setCustomProvision);
		}

		@Override
		public boolean equals(Object o) {
			if (this == o) return true;
			if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
		
			AmendmentEffectiveDate _that = getType().cast(o);
		
			if (!Objects.equals(date, _that.getDate())) return false;
			if (!Objects.equals(specificDate, _that.getSpecificDate())) return false;
			if (!Objects.equals(customProvision, _that.getCustomProvision())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (date != null ? date.hashCode() : 0);
			_result = 31 * _result + (specificDate != null ? specificDate.getClass().getName().hashCode() : 0);
			_result = 31 * _result + (customProvision != null ? customProvision.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "AmendmentEffectiveDate {" +
				"date=" + this.date + ", " +
				"specificDate=" + this.specificDate + ", " +
				"customProvision=" + this.customProvision +
			'}';
		}
	}

	/*********************** Builder Implementation of AmendmentEffectiveDate  ***********************/
	class AmendmentEffectiveDateBuilderImpl implements AmendmentEffectiveDate.AmendmentEffectiveDateBuilder {
	
		protected Date date;
		protected AmendmentEffectiveDateEnum specificDate;
		protected String customProvision;
	
		public AmendmentEffectiveDateBuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("date")
		public Date getDate() {
			return date;
		}
		
		@Override
		@RosettaAttribute("specificDate")
		public AmendmentEffectiveDateEnum getSpecificDate() {
			return specificDate;
		}
		
		@Override
		@RosettaAttribute("customProvision")
		public String getCustomProvision() {
			return customProvision;
		}
		
		@Override
		@RosettaAttribute("date")
		public AmendmentEffectiveDate.AmendmentEffectiveDateBuilder setDate(Date date) {
			this.date = date==null?null:date;
			return this;
		}
		@Override
		@RosettaAttribute("specificDate")
		public AmendmentEffectiveDate.AmendmentEffectiveDateBuilder setSpecificDate(AmendmentEffectiveDateEnum specificDate) {
			this.specificDate = specificDate==null?null:specificDate;
			return this;
		}
		@Override
		@RosettaAttribute("customProvision")
		public AmendmentEffectiveDate.AmendmentEffectiveDateBuilder setCustomProvision(String customProvision) {
			this.customProvision = customProvision==null?null:customProvision;
			return this;
		}
		
		@Override
		public AmendmentEffectiveDate build() {
			return new AmendmentEffectiveDate.AmendmentEffectiveDateImpl(this);
		}
		
		@Override
		public AmendmentEffectiveDate.AmendmentEffectiveDateBuilder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public AmendmentEffectiveDate.AmendmentEffectiveDateBuilder prune() {
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getDate()!=null) return true;
			if (getSpecificDate()!=null) return true;
			if (getCustomProvision()!=null) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public AmendmentEffectiveDate.AmendmentEffectiveDateBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			AmendmentEffectiveDate.AmendmentEffectiveDateBuilder o = (AmendmentEffectiveDate.AmendmentEffectiveDateBuilder) other;
			
			
			merger.mergeBasic(getDate(), o.getDate(), this::setDate);
			merger.mergeBasic(getSpecificDate(), o.getSpecificDate(), this::setSpecificDate);
			merger.mergeBasic(getCustomProvision(), o.getCustomProvision(), this::setCustomProvision);
			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;
		
			AmendmentEffectiveDate _that = getType().cast(o);
		
			if (!Objects.equals(date, _that.getDate())) return false;
			if (!Objects.equals(specificDate, _that.getSpecificDate())) return false;
			if (!Objects.equals(customProvision, _that.getCustomProvision())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (date != null ? date.hashCode() : 0);
			_result = 31 * _result + (specificDate != null ? specificDate.getClass().getName().hashCode() : 0);
			_result = 31 * _result + (customProvision != null ? customProvision.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "AmendmentEffectiveDateBuilder {" +
				"date=" + this.date + ", " +
				"specificDate=" + this.specificDate + ", " +
				"customProvision=" + this.customProvision +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy