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

com.rosetta.jsonparsingtestschargor.model.TopLaw 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.TopLaw;
import com.rosetta.jsonparsingtestschargor.model.TopLaw.TopLawBuilder;
import com.rosetta.jsonparsingtestschargor.model.TopLaw.TopLawBuilderImpl;
import com.rosetta.jsonparsingtestschargor.model.TopLaw.TopLawImpl;
import com.rosetta.jsonparsingtestschargor.model.meta.TopLawMeta;
import com.rosetta.jsonparsingtestschargor.model.metafields.ReferenceWithMetaPostingObligationsElection;
import com.rosetta.jsonparsingtestschargor.model.metafields.ReferenceWithMetaPostingObligationsElection.ReferenceWithMetaPostingObligationsElectionBuilder;
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="TopLaw", builder=TopLaw.TopLawBuilderImpl.class, version="test")
public interface TopLaw extends RosettaModelObject {

	TopLawMeta metaData = new TopLawMeta();

	/*********************** Getter Methods  ***********************/
	ReferenceWithMetaPostingObligationsElection getPobsField();

	/*********************** Build Methods  ***********************/
	TopLaw build();
	
	TopLaw.TopLawBuilder toBuilder();
	
	static TopLaw.TopLawBuilder builder() {
		return new TopLaw.TopLawBuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return TopLaw.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("pobsField"), processor, ReferenceWithMetaPostingObligationsElection.class, getPobsField());
	}
	

	/*********************** Builder Interface  ***********************/
	interface TopLawBuilder extends TopLaw, RosettaModelObjectBuilder {
		ReferenceWithMetaPostingObligationsElection.ReferenceWithMetaPostingObligationsElectionBuilder getOrCreatePobsField();
		ReferenceWithMetaPostingObligationsElection.ReferenceWithMetaPostingObligationsElectionBuilder getPobsField();
		TopLaw.TopLawBuilder setPobsField(ReferenceWithMetaPostingObligationsElection pobsField0);
		TopLaw.TopLawBuilder setPobsFieldValue(PostingObligationsElection pobsField1);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("pobsField"), processor, ReferenceWithMetaPostingObligationsElection.ReferenceWithMetaPostingObligationsElectionBuilder.class, getPobsField());
		}
		

		TopLaw.TopLawBuilder prune();
	}

	/*********************** Immutable Implementation of TopLaw  ***********************/
	class TopLawImpl implements TopLaw {
		private final ReferenceWithMetaPostingObligationsElection pobsField;
		
		protected TopLawImpl(TopLaw.TopLawBuilder builder) {
			this.pobsField = ofNullable(builder.getPobsField()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("pobsField")
		public ReferenceWithMetaPostingObligationsElection getPobsField() {
			return pobsField;
		}
		
		@Override
		public TopLaw build() {
			return this;
		}
		
		@Override
		public TopLaw.TopLawBuilder toBuilder() {
			TopLaw.TopLawBuilder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(TopLaw.TopLawBuilder builder) {
			ofNullable(getPobsField()).ifPresent(builder::setPobsField);
		}

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

	/*********************** Builder Implementation of TopLaw  ***********************/
	class TopLawBuilderImpl implements TopLaw.TopLawBuilder {
	
		protected ReferenceWithMetaPostingObligationsElection.ReferenceWithMetaPostingObligationsElectionBuilder pobsField;
	
		public TopLawBuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("pobsField")
		public ReferenceWithMetaPostingObligationsElection.ReferenceWithMetaPostingObligationsElectionBuilder getPobsField() {
			return pobsField;
		}
		
		@Override
		public ReferenceWithMetaPostingObligationsElection.ReferenceWithMetaPostingObligationsElectionBuilder getOrCreatePobsField() {
			ReferenceWithMetaPostingObligationsElection.ReferenceWithMetaPostingObligationsElectionBuilder result;
			if (pobsField!=null) {
				result = pobsField;
			}
			else {
				result = pobsField = ReferenceWithMetaPostingObligationsElection.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("pobsField")
		public TopLaw.TopLawBuilder setPobsField(ReferenceWithMetaPostingObligationsElection pobsField) {
			this.pobsField = pobsField==null?null:pobsField.toBuilder();
			return this;
		}
		@Override
		public TopLaw.TopLawBuilder setPobsFieldValue(PostingObligationsElection pobsField) {
			this.getOrCreatePobsField().setValue(pobsField);
			return this;
		}
		
		@Override
		public TopLaw build() {
			return new TopLaw.TopLawImpl(this);
		}
		
		@Override
		public TopLaw.TopLawBuilder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public TopLaw.TopLawBuilder prune() {
			if (pobsField!=null && !pobsField.prune().hasData()) pobsField = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getPobsField()!=null && getPobsField().hasData()) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public TopLaw.TopLawBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			TopLaw.TopLawBuilder o = (TopLaw.TopLawBuilder) other;
			
			merger.mergeRosetta(getPobsField(), o.getPobsField(), this::setPobsField);
			
			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;
		
			TopLaw _that = getType().cast(o);
		
			if (!Objects.equals(pobsField, _that.getPobsField())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (pobsField != null ? pobsField.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "TopLawBuilder {" +
				"pobsField=" + this.pobsField +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy