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

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

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

import com.rosetta.jptlegalagreement.model.BusinessCenterTime;
import com.rosetta.jptlegalagreement.model.DisputeResolution;
import com.rosetta.jptlegalagreement.model.DisputeResolution.DisputeResolutionBuilder;
import com.rosetta.jptlegalagreement.model.DisputeResolution.DisputeResolutionBuilderImpl;
import com.rosetta.jptlegalagreement.model.DisputeResolution.DisputeResolutionImpl;
import com.rosetta.jptlegalagreement.model.meta.DisputeResolutionMeta;
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="DisputeResolution", builder=DisputeResolution.DisputeResolutionBuilderImpl.class, version="test")
public interface DisputeResolution extends RosettaModelObject {

	DisputeResolutionMeta metaData = new DisputeResolutionMeta();

	/*********************** Getter Methods  ***********************/
	BusinessCenterTime getResolutionTime();
	String getOtherTerms();

	/*********************** Build Methods  ***********************/
	DisputeResolution build();
	
	DisputeResolution.DisputeResolutionBuilder toBuilder();
	
	static DisputeResolution.DisputeResolutionBuilder builder() {
		return new DisputeResolution.DisputeResolutionBuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return DisputeResolution.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("resolutionTime"), processor, BusinessCenterTime.class, getResolutionTime());
		processor.processBasic(path.newSubPath("otherTerms"), String.class, getOtherTerms(), this);
	}
	

	/*********************** Builder Interface  ***********************/
	interface DisputeResolutionBuilder extends DisputeResolution, RosettaModelObjectBuilder {
		BusinessCenterTime.BusinessCenterTimeBuilder getOrCreateResolutionTime();
		BusinessCenterTime.BusinessCenterTimeBuilder getResolutionTime();
		DisputeResolution.DisputeResolutionBuilder setResolutionTime(BusinessCenterTime resolutionTime);
		DisputeResolution.DisputeResolutionBuilder setOtherTerms(String otherTerms);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("resolutionTime"), processor, BusinessCenterTime.BusinessCenterTimeBuilder.class, getResolutionTime());
			processor.processBasic(path.newSubPath("otherTerms"), String.class, getOtherTerms(), this);
		}
		

		DisputeResolution.DisputeResolutionBuilder prune();
	}

	/*********************** Immutable Implementation of DisputeResolution  ***********************/
	class DisputeResolutionImpl implements DisputeResolution {
		private final BusinessCenterTime resolutionTime;
		private final String otherTerms;
		
		protected DisputeResolutionImpl(DisputeResolution.DisputeResolutionBuilder builder) {
			this.resolutionTime = ofNullable(builder.getResolutionTime()).map(f->f.build()).orElse(null);
			this.otherTerms = builder.getOtherTerms();
		}
		
		@Override
		@RosettaAttribute("resolutionTime")
		public BusinessCenterTime getResolutionTime() {
			return resolutionTime;
		}
		
		@Override
		@RosettaAttribute("otherTerms")
		public String getOtherTerms() {
			return otherTerms;
		}
		
		@Override
		public DisputeResolution build() {
			return this;
		}
		
		@Override
		public DisputeResolution.DisputeResolutionBuilder toBuilder() {
			DisputeResolution.DisputeResolutionBuilder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(DisputeResolution.DisputeResolutionBuilder builder) {
			ofNullable(getResolutionTime()).ifPresent(builder::setResolutionTime);
			ofNullable(getOtherTerms()).ifPresent(builder::setOtherTerms);
		}

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

	/*********************** Builder Implementation of DisputeResolution  ***********************/
	class DisputeResolutionBuilderImpl implements DisputeResolution.DisputeResolutionBuilder {
	
		protected BusinessCenterTime.BusinessCenterTimeBuilder resolutionTime;
		protected String otherTerms;
	
		public DisputeResolutionBuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("resolutionTime")
		public BusinessCenterTime.BusinessCenterTimeBuilder getResolutionTime() {
			return resolutionTime;
		}
		
		@Override
		public BusinessCenterTime.BusinessCenterTimeBuilder getOrCreateResolutionTime() {
			BusinessCenterTime.BusinessCenterTimeBuilder result;
			if (resolutionTime!=null) {
				result = resolutionTime;
			}
			else {
				result = resolutionTime = BusinessCenterTime.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("otherTerms")
		public String getOtherTerms() {
			return otherTerms;
		}
		
		@Override
		@RosettaAttribute("resolutionTime")
		public DisputeResolution.DisputeResolutionBuilder setResolutionTime(BusinessCenterTime resolutionTime) {
			this.resolutionTime = resolutionTime==null?null:resolutionTime.toBuilder();
			return this;
		}
		@Override
		@RosettaAttribute("otherTerms")
		public DisputeResolution.DisputeResolutionBuilder setOtherTerms(String otherTerms) {
			this.otherTerms = otherTerms==null?null:otherTerms;
			return this;
		}
		
		@Override
		public DisputeResolution build() {
			return new DisputeResolution.DisputeResolutionImpl(this);
		}
		
		@Override
		public DisputeResolution.DisputeResolutionBuilder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public DisputeResolution.DisputeResolutionBuilder prune() {
			if (resolutionTime!=null && !resolutionTime.prune().hasData()) resolutionTime = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getResolutionTime()!=null && getResolutionTime().hasData()) return true;
			if (getOtherTerms()!=null) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public DisputeResolution.DisputeResolutionBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			DisputeResolution.DisputeResolutionBuilder o = (DisputeResolution.DisputeResolutionBuilder) other;
			
			merger.mergeRosetta(getResolutionTime(), o.getResolutionTime(), this::setResolutionTime);
			
			merger.mergeBasic(getOtherTerms(), o.getOtherTerms(), this::setOtherTerms);
			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;
		
			DisputeResolution _that = getType().cast(o);
		
			if (!Objects.equals(resolutionTime, _that.getResolutionTime())) return false;
			if (!Objects.equals(otherTerms, _that.getOtherTerms())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (resolutionTime != null ? resolutionTime.hashCode() : 0);
			_result = 31 * _result + (otherTerms != null ? otherTerms.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "DisputeResolutionBuilder {" +
				"resolutionTime=" + this.resolutionTime + ", " +
				"otherTerms=" + this.otherTerms +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy