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

com.rosetta.metatest.model.ResolvablePayoutQuantity Maven / Gradle / Ivy

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

import com.rosetta.metatest.model.Quantity;
import com.rosetta.metatest.model.ResolvablePayoutQuantity;
import com.rosetta.metatest.model.ResolvablePayoutQuantity.ResolvablePayoutQuantityBuilder;
import com.rosetta.metatest.model.ResolvablePayoutQuantity.ResolvablePayoutQuantityBuilderImpl;
import com.rosetta.metatest.model.ResolvablePayoutQuantity.ResolvablePayoutQuantityImpl;
import com.rosetta.metatest.model.meta.ResolvablePayoutQuantityMeta;
import com.rosetta.metatest.model.metafields.ReferenceWithMetaQuantity;
import com.rosetta.metatest.model.metafields.ReferenceWithMetaQuantity.ReferenceWithMetaQuantityBuilder;
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="ResolvablePayoutQuantity", builder=ResolvablePayoutQuantity.ResolvablePayoutQuantityBuilderImpl.class, version="test")
public interface ResolvablePayoutQuantity extends RosettaModelObject {

	ResolvablePayoutQuantityMeta metaData = new ResolvablePayoutQuantityMeta();

	/*********************** Getter Methods  ***********************/
	ReferenceWithMetaQuantity getResolvedQuantity();

	/*********************** Build Methods  ***********************/
	ResolvablePayoutQuantity build();
	
	ResolvablePayoutQuantity.ResolvablePayoutQuantityBuilder toBuilder();
	
	static ResolvablePayoutQuantity.ResolvablePayoutQuantityBuilder builder() {
		return new ResolvablePayoutQuantity.ResolvablePayoutQuantityBuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return ResolvablePayoutQuantity.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("resolvedQuantity"), processor, ReferenceWithMetaQuantity.class, getResolvedQuantity());
	}
	

	/*********************** Builder Interface  ***********************/
	interface ResolvablePayoutQuantityBuilder extends ResolvablePayoutQuantity, RosettaModelObjectBuilder {
		ReferenceWithMetaQuantity.ReferenceWithMetaQuantityBuilder getOrCreateResolvedQuantity();
		ReferenceWithMetaQuantity.ReferenceWithMetaQuantityBuilder getResolvedQuantity();
		ResolvablePayoutQuantity.ResolvablePayoutQuantityBuilder setResolvedQuantity(ReferenceWithMetaQuantity resolvedQuantity0);
		ResolvablePayoutQuantity.ResolvablePayoutQuantityBuilder setResolvedQuantityValue(Quantity resolvedQuantity1);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("resolvedQuantity"), processor, ReferenceWithMetaQuantity.ReferenceWithMetaQuantityBuilder.class, getResolvedQuantity());
		}
		

		ResolvablePayoutQuantity.ResolvablePayoutQuantityBuilder prune();
	}

	/*********************** Immutable Implementation of ResolvablePayoutQuantity  ***********************/
	class ResolvablePayoutQuantityImpl implements ResolvablePayoutQuantity {
		private final ReferenceWithMetaQuantity resolvedQuantity;
		
		protected ResolvablePayoutQuantityImpl(ResolvablePayoutQuantity.ResolvablePayoutQuantityBuilder builder) {
			this.resolvedQuantity = ofNullable(builder.getResolvedQuantity()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("resolvedQuantity")
		public ReferenceWithMetaQuantity getResolvedQuantity() {
			return resolvedQuantity;
		}
		
		@Override
		public ResolvablePayoutQuantity build() {
			return this;
		}
		
		@Override
		public ResolvablePayoutQuantity.ResolvablePayoutQuantityBuilder toBuilder() {
			ResolvablePayoutQuantity.ResolvablePayoutQuantityBuilder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(ResolvablePayoutQuantity.ResolvablePayoutQuantityBuilder builder) {
			ofNullable(getResolvedQuantity()).ifPresent(builder::setResolvedQuantity);
		}

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

	/*********************** Builder Implementation of ResolvablePayoutQuantity  ***********************/
	class ResolvablePayoutQuantityBuilderImpl implements ResolvablePayoutQuantity.ResolvablePayoutQuantityBuilder {
	
		protected ReferenceWithMetaQuantity.ReferenceWithMetaQuantityBuilder resolvedQuantity;
	
		public ResolvablePayoutQuantityBuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("resolvedQuantity")
		public ReferenceWithMetaQuantity.ReferenceWithMetaQuantityBuilder getResolvedQuantity() {
			return resolvedQuantity;
		}
		
		@Override
		public ReferenceWithMetaQuantity.ReferenceWithMetaQuantityBuilder getOrCreateResolvedQuantity() {
			ReferenceWithMetaQuantity.ReferenceWithMetaQuantityBuilder result;
			if (resolvedQuantity!=null) {
				result = resolvedQuantity;
			}
			else {
				result = resolvedQuantity = ReferenceWithMetaQuantity.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("resolvedQuantity")
		public ResolvablePayoutQuantity.ResolvablePayoutQuantityBuilder setResolvedQuantity(ReferenceWithMetaQuantity resolvedQuantity) {
			this.resolvedQuantity = resolvedQuantity==null?null:resolvedQuantity.toBuilder();
			return this;
		}
		@Override
		public ResolvablePayoutQuantity.ResolvablePayoutQuantityBuilder setResolvedQuantityValue(Quantity resolvedQuantity) {
			this.getOrCreateResolvedQuantity().setValue(resolvedQuantity);
			return this;
		}
		
		@Override
		public ResolvablePayoutQuantity build() {
			return new ResolvablePayoutQuantity.ResolvablePayoutQuantityImpl(this);
		}
		
		@Override
		public ResolvablePayoutQuantity.ResolvablePayoutQuantityBuilder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public ResolvablePayoutQuantity.ResolvablePayoutQuantityBuilder prune() {
			if (resolvedQuantity!=null && !resolvedQuantity.prune().hasData()) resolvedQuantity = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getResolvedQuantity()!=null && getResolvedQuantity().hasData()) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public ResolvablePayoutQuantity.ResolvablePayoutQuantityBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			ResolvablePayoutQuantity.ResolvablePayoutQuantityBuilder o = (ResolvablePayoutQuantity.ResolvablePayoutQuantityBuilder) other;
			
			merger.mergeRosetta(getResolvedQuantity(), o.getResolvedQuantity(), this::setResolvedQuantity);
			
			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;
		
			ResolvablePayoutQuantity _that = getType().cast(o);
		
			if (!Objects.equals(resolvedQuantity, _that.getResolvedQuantity())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (resolvedQuantity != null ? resolvedQuantity.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "ResolvablePayoutQuantityBuilder {" +
				"resolvedQuantity=" + this.resolvedQuantity +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy