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

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

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

import com.rosetta.jsonparsingtestschargor.model.PostingObligationsElection;
import com.rosetta.jsonparsingtestschargor.model.PostingObligationsElection.PostingObligationsElectionBuilder;
import com.rosetta.jsonparsingtestschargor.model.PostingObligationsElection.PostingObligationsElectionBuilderImpl;
import com.rosetta.jsonparsingtestschargor.model.PostingObligationsElection.PostingObligationsElectionImpl;
import com.rosetta.jsonparsingtestschargor.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  ***********************/
	String getParty();
	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("party"), String.class, getParty(), this);
		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 setParty(String party);
		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("party"), String.class, getParty(), this);
			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 String party;
		private final Boolean asPermitted;
		private final String excludedCollateral;
		private final String additionalLanguage;
		private final MetaFields meta;
		
		protected PostingObligationsElectionImpl(PostingObligationsElection.PostingObligationsElectionBuilder builder) {
			this.party = builder.getParty();
			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("party")
		public String getParty() {
			return party;
		}
		
		@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(getParty()).ifPresent(builder::setParty);
			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(party, _that.getParty())) return false;
			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 + (party != null ? party.hashCode() : 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 {" +
				"party=" + this.party + ", " +
				"asPermitted=" + this.asPermitted + ", " +
				"excludedCollateral=" + this.excludedCollateral + ", " +
				"additionalLanguage=" + this.additionalLanguage + ", " +
				"meta=" + this.meta +
			'}';
		}
	}

	/*********************** Builder Implementation of PostingObligationsElection  ***********************/
	class PostingObligationsElectionBuilderImpl implements PostingObligationsElection.PostingObligationsElectionBuilder, GlobalKeyBuilder {
	
		protected String party;
		protected Boolean asPermitted;
		protected String excludedCollateral;
		protected String additionalLanguage;
		protected MetaFields.MetaFieldsBuilder meta;
	
		public PostingObligationsElectionBuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("party")
		public String getParty() {
			return party;
		}
		
		@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("party")
		public PostingObligationsElection.PostingObligationsElectionBuilder setParty(String party) {
			this.party = party==null?null:party;
			return this;
		}
		@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 (getParty()!=null) return true;
			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(getParty(), o.getParty(), this::setParty);
			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(party, _that.getParty())) return false;
			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 + (party != null ? party.hashCode() : 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 {" +
				"party=" + this.party + ", " +
				"asPermitted=" + this.asPermitted + ", " +
				"excludedCollateral=" + this.excludedCollateral + ", " +
				"additionalLanguage=" + this.additionalLanguage + ", " +
				"meta=" + this.meta +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy