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

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

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

import com.rosetta.jptlegalagreement.model.PostingObligationsElection;
import com.rosetta.jptlegalagreement.model.PostingObligationsElection.PostingObligationsElectionBuilder;
import com.rosetta.jptlegalagreement.model.PostingObligationsElection.PostingObligationsElectionBuilderImpl;
import com.rosetta.jptlegalagreement.model.PostingObligationsElection.PostingObligationsElectionImpl;
import com.rosetta.jptlegalagreement.model.meta.PostingObligationsElectionMeta;
import com.rosetta.model.lib.GlobalKey;
import com.rosetta.model.lib.GlobalKey.GlobalKeyBuilder;
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.metafields.MetaFields;
import java.util.Objects;

import static java.util.Optional.ofNullable;

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

	PostingObligationsElectionMeta metaData = new PostingObligationsElectionMeta();

	/*********************** Getter Methods  ***********************/
	Boolean getAsPermitted();
	String getExcludedCollateral();
	String getAdditionalLanguage();
	MetaFields getMeta();

	/*********************** Build Methods  ***********************/
	PostingObligationsElection build();
	
	PostingObligationsElection.PostingObligationsElectionBuilder toBuilder();
	
	static PostingObligationsElection.PostingObligationsElectionBuilder builder() {
		return new PostingObligationsElection.PostingObligationsElectionBuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return PostingObligationsElection.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processor.processBasic(path.newSubPath("asPermitted"), Boolean.class, getAsPermitted(), this);
		processor.processBasic(path.newSubPath("excludedCollateral"), String.class, getExcludedCollateral(), this);
		processor.processBasic(path.newSubPath("additionalLanguage"), String.class, getAdditionalLanguage(), this);
		processRosetta(path.newSubPath("meta"), processor, MetaFields.class, getMeta());
	}
	

	/*********************** Builder Interface  ***********************/
	interface PostingObligationsElectionBuilder extends PostingObligationsElection, RosettaModelObjectBuilder {
		MetaFields.MetaFieldsBuilder getOrCreateMeta();
		MetaFields.MetaFieldsBuilder getMeta();
		PostingObligationsElection.PostingObligationsElectionBuilder setAsPermitted(Boolean asPermitted);
		PostingObligationsElection.PostingObligationsElectionBuilder setExcludedCollateral(String excludedCollateral);
		PostingObligationsElection.PostingObligationsElectionBuilder setAdditionalLanguage(String additionalLanguage);
		PostingObligationsElection.PostingObligationsElectionBuilder setMeta(MetaFields meta);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processor.processBasic(path.newSubPath("asPermitted"), Boolean.class, getAsPermitted(), this);
			processor.processBasic(path.newSubPath("excludedCollateral"), String.class, getExcludedCollateral(), this);
			processor.processBasic(path.newSubPath("additionalLanguage"), String.class, getAdditionalLanguage(), this);
			processRosetta(path.newSubPath("meta"), processor, MetaFields.MetaFieldsBuilder.class, getMeta());
		}
		

		PostingObligationsElection.PostingObligationsElectionBuilder prune();
	}

	/*********************** Immutable Implementation of PostingObligationsElection  ***********************/
	class PostingObligationsElectionImpl implements PostingObligationsElection {
		private final Boolean asPermitted;
		private final String excludedCollateral;
		private final String additionalLanguage;
		private final MetaFields meta;
		
		protected PostingObligationsElectionImpl(PostingObligationsElection.PostingObligationsElectionBuilder builder) {
			this.asPermitted = builder.getAsPermitted();
			this.excludedCollateral = builder.getExcludedCollateral();
			this.additionalLanguage = builder.getAdditionalLanguage();
			this.meta = ofNullable(builder.getMeta()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("asPermitted")
		public Boolean getAsPermitted() {
			return asPermitted;
		}
		
		@Override
		@RosettaAttribute("excludedCollateral")
		public String getExcludedCollateral() {
			return excludedCollateral;
		}
		
		@Override
		@RosettaAttribute("additionalLanguage")
		public String getAdditionalLanguage() {
			return additionalLanguage;
		}
		
		@Override
		@RosettaAttribute("meta")
		public MetaFields getMeta() {
			return meta;
		}
		
		@Override
		public PostingObligationsElection build() {
			return this;
		}
		
		@Override
		public PostingObligationsElection.PostingObligationsElectionBuilder toBuilder() {
			PostingObligationsElection.PostingObligationsElectionBuilder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(PostingObligationsElection.PostingObligationsElectionBuilder builder) {
			ofNullable(getAsPermitted()).ifPresent(builder::setAsPermitted);
			ofNullable(getExcludedCollateral()).ifPresent(builder::setExcludedCollateral);
			ofNullable(getAdditionalLanguage()).ifPresent(builder::setAdditionalLanguage);
			ofNullable(getMeta()).ifPresent(builder::setMeta);
		}

		@Override
		public boolean equals(Object o) {
			if (this == o) return true;
			if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
		
			PostingObligationsElection _that = getType().cast(o);
		
			if (!Objects.equals(asPermitted, _that.getAsPermitted())) return false;
			if (!Objects.equals(excludedCollateral, _that.getExcludedCollateral())) return false;
			if (!Objects.equals(additionalLanguage, _that.getAdditionalLanguage())) return false;
			if (!Objects.equals(meta, _that.getMeta())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (asPermitted != null ? asPermitted.hashCode() : 0);
			_result = 31 * _result + (excludedCollateral != null ? excludedCollateral.hashCode() : 0);
			_result = 31 * _result + (additionalLanguage != null ? additionalLanguage.hashCode() : 0);
			_result = 31 * _result + (meta != null ? meta.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "PostingObligationsElection {" +
				"asPermitted=" + this.asPermitted + ", " +
				"excludedCollateral=" + this.excludedCollateral + ", " +
				"additionalLanguage=" + this.additionalLanguage + ", " +
				"meta=" + this.meta +
			'}';
		}
	}

	/*********************** Builder Implementation of PostingObligationsElection  ***********************/
	class PostingObligationsElectionBuilderImpl implements PostingObligationsElection.PostingObligationsElectionBuilder, GlobalKeyBuilder {
	
		protected Boolean asPermitted;
		protected String excludedCollateral;
		protected String additionalLanguage;
		protected MetaFields.MetaFieldsBuilder meta;
	
		public PostingObligationsElectionBuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("asPermitted")
		public Boolean getAsPermitted() {
			return asPermitted;
		}
		
		@Override
		@RosettaAttribute("excludedCollateral")
		public String getExcludedCollateral() {
			return excludedCollateral;
		}
		
		@Override
		@RosettaAttribute("additionalLanguage")
		public String getAdditionalLanguage() {
			return additionalLanguage;
		}
		
		@Override
		@RosettaAttribute("meta")
		public MetaFields.MetaFieldsBuilder getMeta() {
			return meta;
		}
		
		@Override
		public MetaFields.MetaFieldsBuilder getOrCreateMeta() {
			MetaFields.MetaFieldsBuilder result;
			if (meta!=null) {
				result = meta;
			}
			else {
				result = meta = MetaFields.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("asPermitted")
		public PostingObligationsElection.PostingObligationsElectionBuilder setAsPermitted(Boolean asPermitted) {
			this.asPermitted = asPermitted==null?null:asPermitted;
			return this;
		}
		@Override
		@RosettaAttribute("excludedCollateral")
		public PostingObligationsElection.PostingObligationsElectionBuilder setExcludedCollateral(String excludedCollateral) {
			this.excludedCollateral = excludedCollateral==null?null:excludedCollateral;
			return this;
		}
		@Override
		@RosettaAttribute("additionalLanguage")
		public PostingObligationsElection.PostingObligationsElectionBuilder setAdditionalLanguage(String additionalLanguage) {
			this.additionalLanguage = additionalLanguage==null?null:additionalLanguage;
			return this;
		}
		@Override
		@RosettaAttribute("meta")
		public PostingObligationsElection.PostingObligationsElectionBuilder setMeta(MetaFields meta) {
			this.meta = meta==null?null:meta.toBuilder();
			return this;
		}
		
		@Override
		public PostingObligationsElection build() {
			return new PostingObligationsElection.PostingObligationsElectionImpl(this);
		}
		
		@Override
		public PostingObligationsElection.PostingObligationsElectionBuilder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public PostingObligationsElection.PostingObligationsElectionBuilder prune() {
			if (meta!=null && !meta.prune().hasData()) meta = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getAsPermitted()!=null) return true;
			if (getExcludedCollateral()!=null) return true;
			if (getAdditionalLanguage()!=null) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public PostingObligationsElection.PostingObligationsElectionBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			PostingObligationsElection.PostingObligationsElectionBuilder o = (PostingObligationsElection.PostingObligationsElectionBuilder) other;
			
			merger.mergeRosetta(getMeta(), o.getMeta(), this::setMeta);
			
			merger.mergeBasic(getAsPermitted(), o.getAsPermitted(), this::setAsPermitted);
			merger.mergeBasic(getExcludedCollateral(), o.getExcludedCollateral(), this::setExcludedCollateral);
			merger.mergeBasic(getAdditionalLanguage(), o.getAdditionalLanguage(), this::setAdditionalLanguage);
			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;
		
			PostingObligationsElection _that = getType().cast(o);
		
			if (!Objects.equals(asPermitted, _that.getAsPermitted())) return false;
			if (!Objects.equals(excludedCollateral, _that.getExcludedCollateral())) return false;
			if (!Objects.equals(additionalLanguage, _that.getAdditionalLanguage())) return false;
			if (!Objects.equals(meta, _that.getMeta())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (asPermitted != null ? asPermitted.hashCode() : 0);
			_result = 31 * _result + (excludedCollateral != null ? excludedCollateral.hashCode() : 0);
			_result = 31 * _result + (additionalLanguage != null ? additionalLanguage.hashCode() : 0);
			_result = 31 * _result + (meta != null ? meta.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "PostingObligationsElectionBuilder {" +
				"asPermitted=" + this.asPermitted + ", " +
				"excludedCollateral=" + this.excludedCollateral + ", " +
				"additionalLanguage=" + this.additionalLanguage + ", " +
				"meta=" + this.meta +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy