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

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

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

import com.rosetta.jptlegalagreement.model.BusinessCenterTime;
import com.rosetta.jptlegalagreement.model.NotificationTimeElection;
import com.rosetta.jptlegalagreement.model.NotificationTimeElection.NotificationTimeElectionBuilder;
import com.rosetta.jptlegalagreement.model.NotificationTimeElection.NotificationTimeElectionBuilderImpl;
import com.rosetta.jptlegalagreement.model.NotificationTimeElection.NotificationTimeElectionImpl;
import com.rosetta.jptlegalagreement.model.Party;
import com.rosetta.jptlegalagreement.model.meta.NotificationTimeElectionMeta;
import com.rosetta.jptlegalagreement.model.metafields.ReferenceWithMetaParty;
import com.rosetta.jptlegalagreement.model.metafields.ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder;
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="NotificationTimeElection", builder=NotificationTimeElection.NotificationTimeElectionBuilderImpl.class, version="test")
public interface NotificationTimeElection extends RosettaModelObject {

	NotificationTimeElectionMeta metaData = new NotificationTimeElectionMeta();

	/*********************** Getter Methods  ***********************/
	ReferenceWithMetaParty getParty();
	BusinessCenterTime getNotificationTime();
	String getCustomNotification();

	/*********************** Build Methods  ***********************/
	NotificationTimeElection build();
	
	NotificationTimeElection.NotificationTimeElectionBuilder toBuilder();
	
	static NotificationTimeElection.NotificationTimeElectionBuilder builder() {
		return new NotificationTimeElection.NotificationTimeElectionBuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return NotificationTimeElection.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("party"), processor, ReferenceWithMetaParty.class, getParty());
		processRosetta(path.newSubPath("notificationTime"), processor, BusinessCenterTime.class, getNotificationTime());
		processor.processBasic(path.newSubPath("customNotification"), String.class, getCustomNotification(), this);
	}
	

	/*********************** Builder Interface  ***********************/
	interface NotificationTimeElectionBuilder extends NotificationTimeElection, RosettaModelObjectBuilder {
		ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder getOrCreateParty();
		ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder getParty();
		BusinessCenterTime.BusinessCenterTimeBuilder getOrCreateNotificationTime();
		BusinessCenterTime.BusinessCenterTimeBuilder getNotificationTime();
		NotificationTimeElection.NotificationTimeElectionBuilder setParty(ReferenceWithMetaParty party0);
		NotificationTimeElection.NotificationTimeElectionBuilder setPartyValue(Party party1);
		NotificationTimeElection.NotificationTimeElectionBuilder setNotificationTime(BusinessCenterTime notificationTime);
		NotificationTimeElection.NotificationTimeElectionBuilder setCustomNotification(String customNotification);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("party"), processor, ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder.class, getParty());
			processRosetta(path.newSubPath("notificationTime"), processor, BusinessCenterTime.BusinessCenterTimeBuilder.class, getNotificationTime());
			processor.processBasic(path.newSubPath("customNotification"), String.class, getCustomNotification(), this);
		}
		

		NotificationTimeElection.NotificationTimeElectionBuilder prune();
	}

	/*********************** Immutable Implementation of NotificationTimeElection  ***********************/
	class NotificationTimeElectionImpl implements NotificationTimeElection {
		private final ReferenceWithMetaParty party;
		private final BusinessCenterTime notificationTime;
		private final String customNotification;
		
		protected NotificationTimeElectionImpl(NotificationTimeElection.NotificationTimeElectionBuilder builder) {
			this.party = ofNullable(builder.getParty()).map(f->f.build()).orElse(null);
			this.notificationTime = ofNullable(builder.getNotificationTime()).map(f->f.build()).orElse(null);
			this.customNotification = builder.getCustomNotification();
		}
		
		@Override
		@RosettaAttribute("party")
		public ReferenceWithMetaParty getParty() {
			return party;
		}
		
		@Override
		@RosettaAttribute("notificationTime")
		public BusinessCenterTime getNotificationTime() {
			return notificationTime;
		}
		
		@Override
		@RosettaAttribute("customNotification")
		public String getCustomNotification() {
			return customNotification;
		}
		
		@Override
		public NotificationTimeElection build() {
			return this;
		}
		
		@Override
		public NotificationTimeElection.NotificationTimeElectionBuilder toBuilder() {
			NotificationTimeElection.NotificationTimeElectionBuilder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(NotificationTimeElection.NotificationTimeElectionBuilder builder) {
			ofNullable(getParty()).ifPresent(builder::setParty);
			ofNullable(getNotificationTime()).ifPresent(builder::setNotificationTime);
			ofNullable(getCustomNotification()).ifPresent(builder::setCustomNotification);
		}

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

	/*********************** Builder Implementation of NotificationTimeElection  ***********************/
	class NotificationTimeElectionBuilderImpl implements NotificationTimeElection.NotificationTimeElectionBuilder {
	
		protected ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder party;
		protected BusinessCenterTime.BusinessCenterTimeBuilder notificationTime;
		protected String customNotification;
	
		public NotificationTimeElectionBuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("party")
		public ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder getParty() {
			return party;
		}
		
		@Override
		public ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder getOrCreateParty() {
			ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder result;
			if (party!=null) {
				result = party;
			}
			else {
				result = party = ReferenceWithMetaParty.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("notificationTime")
		public BusinessCenterTime.BusinessCenterTimeBuilder getNotificationTime() {
			return notificationTime;
		}
		
		@Override
		public BusinessCenterTime.BusinessCenterTimeBuilder getOrCreateNotificationTime() {
			BusinessCenterTime.BusinessCenterTimeBuilder result;
			if (notificationTime!=null) {
				result = notificationTime;
			}
			else {
				result = notificationTime = BusinessCenterTime.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("customNotification")
		public String getCustomNotification() {
			return customNotification;
		}
		
		@Override
		@RosettaAttribute("party")
		public NotificationTimeElection.NotificationTimeElectionBuilder setParty(ReferenceWithMetaParty party) {
			this.party = party==null?null:party.toBuilder();
			return this;
		}
		@Override
		public NotificationTimeElection.NotificationTimeElectionBuilder setPartyValue(Party party) {
			this.getOrCreateParty().setValue(party);
			return this;
		}
		@Override
		@RosettaAttribute("notificationTime")
		public NotificationTimeElection.NotificationTimeElectionBuilder setNotificationTime(BusinessCenterTime notificationTime) {
			this.notificationTime = notificationTime==null?null:notificationTime.toBuilder();
			return this;
		}
		@Override
		@RosettaAttribute("customNotification")
		public NotificationTimeElection.NotificationTimeElectionBuilder setCustomNotification(String customNotification) {
			this.customNotification = customNotification==null?null:customNotification;
			return this;
		}
		
		@Override
		public NotificationTimeElection build() {
			return new NotificationTimeElection.NotificationTimeElectionImpl(this);
		}
		
		@Override
		public NotificationTimeElection.NotificationTimeElectionBuilder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public NotificationTimeElection.NotificationTimeElectionBuilder prune() {
			if (party!=null && !party.prune().hasData()) party = null;
			if (notificationTime!=null && !notificationTime.prune().hasData()) notificationTime = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getParty()!=null && getParty().hasData()) return true;
			if (getNotificationTime()!=null && getNotificationTime().hasData()) return true;
			if (getCustomNotification()!=null) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public NotificationTimeElection.NotificationTimeElectionBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			NotificationTimeElection.NotificationTimeElectionBuilder o = (NotificationTimeElection.NotificationTimeElectionBuilder) other;
			
			merger.mergeRosetta(getParty(), o.getParty(), this::setParty);
			merger.mergeRosetta(getNotificationTime(), o.getNotificationTime(), this::setNotificationTime);
			
			merger.mergeBasic(getCustomNotification(), o.getCustomNotification(), this::setCustomNotification);
			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;
		
			NotificationTimeElection _that = getType().cast(o);
		
			if (!Objects.equals(party, _that.getParty())) return false;
			if (!Objects.equals(notificationTime, _that.getNotificationTime())) return false;
			if (!Objects.equals(customNotification, _that.getCustomNotification())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (party != null ? party.hashCode() : 0);
			_result = 31 * _result + (notificationTime != null ? notificationTime.hashCode() : 0);
			_result = 31 * _result + (customNotification != null ? customNotification.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "NotificationTimeElectionBuilder {" +
				"party=" + this.party + ", " +
				"notificationTime=" + this.notificationTime + ", " +
				"customNotification=" + this.customNotification +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy