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

com.rosetta.teststruct.model.Offset_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.Offset_10;
import com.rosetta.teststruct.model.Offset_10.Offset_10Builder;
import com.rosetta.teststruct.model.Offset_10.Offset_10BuilderImpl;
import com.rosetta.teststruct.model.Offset_10.Offset_10Impl;
import com.rosetta.teststruct.model.Period_10;
import com.rosetta.teststruct.model.Period_10.Period_10Builder;
import com.rosetta.teststruct.model.Period_10.Period_10BuilderImpl;
import com.rosetta.teststruct.model.Period_10.Period_10Impl;
import com.rosetta.teststruct.model.meta.Offset_10Meta;
import java.util.Objects;

import static java.util.Optional.ofNullable;

/**
 * @version test
 */
@RosettaDataType(value="Offset_10", builder=Offset_10.Offset_10BuilderImpl.class, version="test")
public interface Offset_10 extends Period_10 {

	Offset_10Meta metaData = new Offset_10Meta();

	/*********************** Getter Methods  ***********************/
	String getDayType();

	/*********************** Build Methods  ***********************/
	Offset_10 build();
	
	Offset_10.Offset_10Builder toBuilder();
	
	static Offset_10.Offset_10Builder builder() {
		return new Offset_10.Offset_10BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return Offset_10.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processor.processBasic(path.newSubPath("periodMultiplier"), Integer.class, getPeriodMultiplier(), this);
		processor.processBasic(path.newSubPath("period"), String.class, getPeriod(), this);
		processor.processBasic(path.newSubPath("dayType"), String.class, getDayType(), this);
	}
	

	/*********************** Builder Interface  ***********************/
	interface Offset_10Builder extends Offset_10, Period_10.Period_10Builder {
		Offset_10.Offset_10Builder setPeriodMultiplier(Integer periodMultiplier);
		Offset_10.Offset_10Builder setPeriod(String period);
		Offset_10.Offset_10Builder setDayType(String dayType);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processor.processBasic(path.newSubPath("periodMultiplier"), Integer.class, getPeriodMultiplier(), this);
			processor.processBasic(path.newSubPath("period"), String.class, getPeriod(), this);
			processor.processBasic(path.newSubPath("dayType"), String.class, getDayType(), this);
		}
		

		Offset_10.Offset_10Builder prune();
	}

	/*********************** Immutable Implementation of Offset_10  ***********************/
	class Offset_10Impl extends Period_10.Period_10Impl implements Offset_10 {
		private final String dayType;
		
		protected Offset_10Impl(Offset_10.Offset_10Builder builder) {
			super(builder);
			this.dayType = builder.getDayType();
		}
		
		@Override
		@RosettaAttribute("dayType")
		public String getDayType() {
			return dayType;
		}
		
		@Override
		public Offset_10 build() {
			return this;
		}
		
		@Override
		public Offset_10.Offset_10Builder toBuilder() {
			Offset_10.Offset_10Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(Offset_10.Offset_10Builder builder) {
			super.setBuilderFields(builder);
			ofNullable(getDayType()).ifPresent(builder::setDayType);
		}

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

	/*********************** Builder Implementation of Offset_10  ***********************/
	class Offset_10BuilderImpl extends Period_10.Period_10BuilderImpl  implements Offset_10.Offset_10Builder {
	
		protected String dayType;
	
		public Offset_10BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("dayType")
		public String getDayType() {
			return dayType;
		}
		
		@Override
		@RosettaAttribute("periodMultiplier")
		public Offset_10.Offset_10Builder setPeriodMultiplier(Integer periodMultiplier) {
			this.periodMultiplier = periodMultiplier==null?null:periodMultiplier;
			return this;
		}
		@Override
		@RosettaAttribute("period")
		public Offset_10.Offset_10Builder setPeriod(String period) {
			this.period = period==null?null:period;
			return this;
		}
		@Override
		@RosettaAttribute("dayType")
		public Offset_10.Offset_10Builder setDayType(String dayType) {
			this.dayType = dayType==null?null:dayType;
			return this;
		}
		
		@Override
		public Offset_10 build() {
			return new Offset_10.Offset_10Impl(this);
		}
		
		@Override
		public Offset_10.Offset_10Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Offset_10.Offset_10Builder prune() {
			super.prune();
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (super.hasData()) return true;
			if (getDayType()!=null) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Offset_10.Offset_10Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			super.merge(other, merger);
			
			Offset_10.Offset_10Builder o = (Offset_10.Offset_10Builder) other;
			
			
			merger.mergeBasic(getDayType(), o.getDayType(), this::setDayType);
			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;
			if (!super.equals(o)) return false;
		
			Offset_10 _that = getType().cast(o);
		
			if (!Objects.equals(dayType, _that.getDayType())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = super.hashCode();
			_result = 31 * _result + (dayType != null ? dayType.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "Offset_10Builder {" +
				"dayType=" + this.dayType +
			'}' + " " + super.toString();
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy