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

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

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

import com.rosetta.jptlegalagreement.model.NotificationTime;
import com.rosetta.jptlegalagreement.model.NotificationTime.NotificationTimeBuilder;
import com.rosetta.jptlegalagreement.model.NotificationTime.NotificationTimeBuilderImpl;
import com.rosetta.jptlegalagreement.model.NotificationTime.NotificationTimeImpl;
import com.rosetta.jptlegalagreement.model.NotificationTimeElection;
import com.rosetta.jptlegalagreement.model.meta.NotificationTimeMeta;
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="NotificationTime", builder=NotificationTime.NotificationTimeBuilderImpl.class, version="test")
public interface NotificationTime extends RosettaModelObject {

	NotificationTimeMeta metaData = new NotificationTimeMeta();

	/*********************** Getter Methods  ***********************/
	NotificationTimeElection getPartyElections();

	/*********************** Build Methods  ***********************/
	NotificationTime build();
	
	NotificationTime.NotificationTimeBuilder toBuilder();
	
	static NotificationTime.NotificationTimeBuilder builder() {
		return new NotificationTime.NotificationTimeBuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return NotificationTime.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("partyElections"), processor, NotificationTimeElection.class, getPartyElections());
	}
	

	/*********************** Builder Interface  ***********************/
	interface NotificationTimeBuilder extends NotificationTime, RosettaModelObjectBuilder {
		NotificationTimeElection.NotificationTimeElectionBuilder getOrCreatePartyElections();
		NotificationTimeElection.NotificationTimeElectionBuilder getPartyElections();
		NotificationTime.NotificationTimeBuilder setPartyElections(NotificationTimeElection partyElections);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("partyElections"), processor, NotificationTimeElection.NotificationTimeElectionBuilder.class, getPartyElections());
		}
		

		NotificationTime.NotificationTimeBuilder prune();
	}

	/*********************** Immutable Implementation of NotificationTime  ***********************/
	class NotificationTimeImpl implements NotificationTime {
		private final NotificationTimeElection partyElections;
		
		protected NotificationTimeImpl(NotificationTime.NotificationTimeBuilder builder) {
			this.partyElections = ofNullable(builder.getPartyElections()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("partyElections")
		public NotificationTimeElection getPartyElections() {
			return partyElections;
		}
		
		@Override
		public NotificationTime build() {
			return this;
		}
		
		@Override
		public NotificationTime.NotificationTimeBuilder toBuilder() {
			NotificationTime.NotificationTimeBuilder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(NotificationTime.NotificationTimeBuilder builder) {
			ofNullable(getPartyElections()).ifPresent(builder::setPartyElections);
		}

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

	/*********************** Builder Implementation of NotificationTime  ***********************/
	class NotificationTimeBuilderImpl implements NotificationTime.NotificationTimeBuilder {
	
		protected NotificationTimeElection.NotificationTimeElectionBuilder partyElections;
	
		public NotificationTimeBuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("partyElections")
		public NotificationTimeElection.NotificationTimeElectionBuilder getPartyElections() {
			return partyElections;
		}
		
		@Override
		public NotificationTimeElection.NotificationTimeElectionBuilder getOrCreatePartyElections() {
			NotificationTimeElection.NotificationTimeElectionBuilder result;
			if (partyElections!=null) {
				result = partyElections;
			}
			else {
				result = partyElections = NotificationTimeElection.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("partyElections")
		public NotificationTime.NotificationTimeBuilder setPartyElections(NotificationTimeElection partyElections) {
			this.partyElections = partyElections==null?null:partyElections.toBuilder();
			return this;
		}
		
		@Override
		public NotificationTime build() {
			return new NotificationTime.NotificationTimeImpl(this);
		}
		
		@Override
		public NotificationTime.NotificationTimeBuilder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public NotificationTime.NotificationTimeBuilder prune() {
			if (partyElections!=null && !partyElections.prune().hasData()) partyElections = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getPartyElections()!=null && getPartyElections().hasData()) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public NotificationTime.NotificationTimeBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			NotificationTime.NotificationTimeBuilder o = (NotificationTime.NotificationTimeBuilder) other;
			
			merger.mergeRosetta(getPartyElections(), o.getPartyElections(), this::setPartyElections);
			
			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;
		
			NotificationTime _that = getType().cast(o);
		
			if (!Objects.equals(partyElections, _that.getPartyElections())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (partyElections != null ? partyElections.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "NotificationTimeBuilder {" +
				"partyElections=" + this.partyElections +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy