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

com.rosetta.teststruct.model.DataDocument_10 Maven / Gradle / Ivy

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

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.teststruct.model.DataDocument_10;
import com.rosetta.teststruct.model.DataDocument_10.DataDocument_10Builder;
import com.rosetta.teststruct.model.DataDocument_10.DataDocument_10BuilderImpl;
import com.rosetta.teststruct.model.DataDocument_10.DataDocument_10Impl;
import com.rosetta.teststruct.model.RelativeDateOffset_10;
import com.rosetta.teststruct.model.meta.DataDocument_10Meta;
import java.util.Objects;

import static java.util.Optional.ofNullable;

/**
 * @version test
 */
@RosettaDataType(value="DataDocument_10", builder=DataDocument_10.DataDocument_10BuilderImpl.class, version="test")
public interface DataDocument_10 extends RosettaModelObject {

	DataDocument_10Meta metaData = new DataDocument_10Meta();

	/*********************** Getter Methods  ***********************/
	RelativeDateOffset_10 getRelativeDates();

	/*********************** Build Methods  ***********************/
	DataDocument_10 build();
	
	DataDocument_10.DataDocument_10Builder toBuilder();
	
	static DataDocument_10.DataDocument_10Builder builder() {
		return new DataDocument_10.DataDocument_10BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return DataDocument_10.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("relativeDates"), processor, RelativeDateOffset_10.class, getRelativeDates());
	}
	

	/*********************** Builder Interface  ***********************/
	interface DataDocument_10Builder extends DataDocument_10, RosettaModelObjectBuilder {
		RelativeDateOffset_10.RelativeDateOffset_10Builder getOrCreateRelativeDates();
		RelativeDateOffset_10.RelativeDateOffset_10Builder getRelativeDates();
		DataDocument_10.DataDocument_10Builder setRelativeDates(RelativeDateOffset_10 relativeDates);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("relativeDates"), processor, RelativeDateOffset_10.RelativeDateOffset_10Builder.class, getRelativeDates());
		}
		

		DataDocument_10.DataDocument_10Builder prune();
	}

	/*********************** Immutable Implementation of DataDocument_10  ***********************/
	class DataDocument_10Impl implements DataDocument_10 {
		private final RelativeDateOffset_10 relativeDates;
		
		protected DataDocument_10Impl(DataDocument_10.DataDocument_10Builder builder) {
			this.relativeDates = ofNullable(builder.getRelativeDates()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("relativeDates")
		public RelativeDateOffset_10 getRelativeDates() {
			return relativeDates;
		}
		
		@Override
		public DataDocument_10 build() {
			return this;
		}
		
		@Override
		public DataDocument_10.DataDocument_10Builder toBuilder() {
			DataDocument_10.DataDocument_10Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(DataDocument_10.DataDocument_10Builder builder) {
			ofNullable(getRelativeDates()).ifPresent(builder::setRelativeDates);
		}

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

	/*********************** Builder Implementation of DataDocument_10  ***********************/
	class DataDocument_10BuilderImpl implements DataDocument_10.DataDocument_10Builder {
	
		protected RelativeDateOffset_10.RelativeDateOffset_10Builder relativeDates;
	
		public DataDocument_10BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("relativeDates")
		public RelativeDateOffset_10.RelativeDateOffset_10Builder getRelativeDates() {
			return relativeDates;
		}
		
		@Override
		public RelativeDateOffset_10.RelativeDateOffset_10Builder getOrCreateRelativeDates() {
			RelativeDateOffset_10.RelativeDateOffset_10Builder result;
			if (relativeDates!=null) {
				result = relativeDates;
			}
			else {
				result = relativeDates = RelativeDateOffset_10.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("relativeDates")
		public DataDocument_10.DataDocument_10Builder setRelativeDates(RelativeDateOffset_10 relativeDates) {
			this.relativeDates = relativeDates==null?null:relativeDates.toBuilder();
			return this;
		}
		
		@Override
		public DataDocument_10 build() {
			return new DataDocument_10.DataDocument_10Impl(this);
		}
		
		@Override
		public DataDocument_10.DataDocument_10Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public DataDocument_10.DataDocument_10Builder prune() {
			if (relativeDates!=null && !relativeDates.prune().hasData()) relativeDates = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getRelativeDates()!=null && getRelativeDates().hasData()) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public DataDocument_10.DataDocument_10Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			DataDocument_10.DataDocument_10Builder o = (DataDocument_10.DataDocument_10Builder) other;
			
			merger.mergeRosetta(getRelativeDates(), o.getRelativeDates(), this::setRelativeDates);
			
			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;
		
			DataDocument_10 _that = getType().cast(o);
		
			if (!Objects.equals(relativeDates, _that.getRelativeDates())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (relativeDates != null ? relativeDates.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "DataDocument_10Builder {" +
				"relativeDates=" + this.relativeDates +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy