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

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

The newest version!
package com.rosetta.jptlegalagreement.model;

import com.rosetta.jptlegalagreement.model.SimmException;
import com.rosetta.jptlegalagreement.model.SimmException.SimmExceptionBuilder;
import com.rosetta.jptlegalagreement.model.SimmException.SimmExceptionBuilderImpl;
import com.rosetta.jptlegalagreement.model.SimmException.SimmExceptionImpl;
import com.rosetta.jptlegalagreement.model.SimmExceptionEnum;
import com.rosetta.jptlegalagreement.model.meta.SimmExceptionMeta;
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="SimmException", builder=SimmException.SimmExceptionBuilderImpl.class, version="test")
public interface SimmException extends RosettaModelObject {

	SimmExceptionMeta metaData = new SimmExceptionMeta();

	/*********************** Getter Methods  ***********************/
	SimmExceptionEnum getStandardisedException();
	String getAsSpecified();

	/*********************** Build Methods  ***********************/
	SimmException build();
	
	SimmException.SimmExceptionBuilder toBuilder();
	
	static SimmException.SimmExceptionBuilder builder() {
		return new SimmException.SimmExceptionBuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return SimmException.class;
	}
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processor.processBasic(path.newSubPath("standardisedException"), SimmExceptionEnum.class, getStandardisedException(), this);
		processor.processBasic(path.newSubPath("asSpecified"), String.class, getAsSpecified(), this);
	}
	

	/*********************** Builder Interface  ***********************/
	interface SimmExceptionBuilder extends SimmException, RosettaModelObjectBuilder {
		SimmException.SimmExceptionBuilder setStandardisedException(SimmExceptionEnum standardisedException);
		SimmException.SimmExceptionBuilder setAsSpecified(String asSpecified);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processor.processBasic(path.newSubPath("standardisedException"), SimmExceptionEnum.class, getStandardisedException(), this);
			processor.processBasic(path.newSubPath("asSpecified"), String.class, getAsSpecified(), this);
		}
		

		SimmException.SimmExceptionBuilder prune();
	}

	/*********************** Immutable Implementation of SimmException  ***********************/
	class SimmExceptionImpl implements SimmException {
		private final SimmExceptionEnum standardisedException;
		private final String asSpecified;
		
		protected SimmExceptionImpl(SimmException.SimmExceptionBuilder builder) {
			this.standardisedException = builder.getStandardisedException();
			this.asSpecified = builder.getAsSpecified();
		}
		
		@Override
		@RosettaAttribute("standardisedException")
		public SimmExceptionEnum getStandardisedException() {
			return standardisedException;
		}
		
		@Override
		@RosettaAttribute("asSpecified")
		public String getAsSpecified() {
			return asSpecified;
		}
		
		@Override
		public SimmException build() {
			return this;
		}
		
		@Override
		public SimmException.SimmExceptionBuilder toBuilder() {
			SimmException.SimmExceptionBuilder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(SimmException.SimmExceptionBuilder builder) {
			ofNullable(getStandardisedException()).ifPresent(builder::setStandardisedException);
			ofNullable(getAsSpecified()).ifPresent(builder::setAsSpecified);
		}

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

	/*********************** Builder Implementation of SimmException  ***********************/
	class SimmExceptionBuilderImpl implements SimmException.SimmExceptionBuilder {
	
		protected SimmExceptionEnum standardisedException;
		protected String asSpecified;
		
		@Override
		@RosettaAttribute("standardisedException")
		public SimmExceptionEnum getStandardisedException() {
			return standardisedException;
		}
		
		@Override
		@RosettaAttribute("asSpecified")
		public String getAsSpecified() {
			return asSpecified;
		}
		
		@Override
		@RosettaAttribute("standardisedException")
		public SimmException.SimmExceptionBuilder setStandardisedException(SimmExceptionEnum _standardisedException) {
			this.standardisedException = _standardisedException == null ? null : _standardisedException;
			return this;
		}
		
		@Override
		@RosettaAttribute("asSpecified")
		public SimmException.SimmExceptionBuilder setAsSpecified(String _asSpecified) {
			this.asSpecified = _asSpecified == null ? null : _asSpecified;
			return this;
		}
		
		@Override
		public SimmException build() {
			return new SimmException.SimmExceptionImpl(this);
		}
		
		@Override
		public SimmException.SimmExceptionBuilder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public SimmException.SimmExceptionBuilder prune() {
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getStandardisedException()!=null) return true;
			if (getAsSpecified()!=null) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public SimmException.SimmExceptionBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			SimmException.SimmExceptionBuilder o = (SimmException.SimmExceptionBuilder) other;
			
			
			merger.mergeBasic(getStandardisedException(), o.getStandardisedException(), this::setStandardisedException);
			merger.mergeBasic(getAsSpecified(), o.getAsSpecified(), this::setAsSpecified);
			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;
		
			SimmException _that = getType().cast(o);
		
			if (!Objects.equals(standardisedException, _that.getStandardisedException())) return false;
			if (!Objects.equals(asSpecified, _that.getAsSpecified())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (standardisedException != null ? standardisedException.getClass().getName().hashCode() : 0);
			_result = 31 * _result + (asSpecified != null ? asSpecified.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "SimmExceptionBuilder {" +
				"standardisedException=" + this.standardisedException + ", " +
				"asSpecified=" + this.asSpecified +
			'}';
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy