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

com.rosetta.testcard.model.FieldWithMeta9 Maven / Gradle / Ivy

There is a newer version: 11.25.1
Show newest version
package com.rosetta.testcard.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.testcard.model.FieldWithMeta9;
import com.rosetta.testcard.model.FieldWithMeta9.FieldWithMeta9Builder;
import com.rosetta.testcard.model.FieldWithMeta9.FieldWithMeta9BuilderImpl;
import com.rosetta.testcard.model.FieldWithMeta9.FieldWithMeta9Impl;
import com.rosetta.testcard.model.MetaFields9;
import com.rosetta.testcard.model.meta.FieldWithMeta9Meta;
import java.util.Objects;

import static java.util.Optional.ofNullable;

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

	FieldWithMeta9Meta metaData = new FieldWithMeta9Meta();

	/*********************** Getter Methods  ***********************/
	String getValue9();
	MetaFields9 getMeta9();

	/*********************** Build Methods  ***********************/
	FieldWithMeta9 build();
	
	FieldWithMeta9.FieldWithMeta9Builder toBuilder();
	
	static FieldWithMeta9.FieldWithMeta9Builder builder() {
		return new FieldWithMeta9.FieldWithMeta9BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return FieldWithMeta9.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processor.processBasic(path.newSubPath("value9"), String.class, getValue9(), this);
		processRosetta(path.newSubPath("meta9"), processor, MetaFields9.class, getMeta9());
	}
	

	/*********************** Builder Interface  ***********************/
	interface FieldWithMeta9Builder extends FieldWithMeta9, RosettaModelObjectBuilder {
		MetaFields9.MetaFields9Builder getOrCreateMeta9();
		MetaFields9.MetaFields9Builder getMeta9();
		FieldWithMeta9.FieldWithMeta9Builder setValue9(String value9);
		FieldWithMeta9.FieldWithMeta9Builder setMeta9(MetaFields9 meta9);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processor.processBasic(path.newSubPath("value9"), String.class, getValue9(), this);
			processRosetta(path.newSubPath("meta9"), processor, MetaFields9.MetaFields9Builder.class, getMeta9());
		}
		

		FieldWithMeta9.FieldWithMeta9Builder prune();
	}

	/*********************** Immutable Implementation of FieldWithMeta9  ***********************/
	class FieldWithMeta9Impl implements FieldWithMeta9 {
		private final String value9;
		private final MetaFields9 meta9;
		
		protected FieldWithMeta9Impl(FieldWithMeta9.FieldWithMeta9Builder builder) {
			this.value9 = builder.getValue9();
			this.meta9 = ofNullable(builder.getMeta9()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("value9")
		public String getValue9() {
			return value9;
		}
		
		@Override
		@RosettaAttribute("meta9")
		public MetaFields9 getMeta9() {
			return meta9;
		}
		
		@Override
		public FieldWithMeta9 build() {
			return this;
		}
		
		@Override
		public FieldWithMeta9.FieldWithMeta9Builder toBuilder() {
			FieldWithMeta9.FieldWithMeta9Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(FieldWithMeta9.FieldWithMeta9Builder builder) {
			ofNullable(getValue9()).ifPresent(builder::setValue9);
			ofNullable(getMeta9()).ifPresent(builder::setMeta9);
		}

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

	/*********************** Builder Implementation of FieldWithMeta9  ***********************/
	class FieldWithMeta9BuilderImpl implements FieldWithMeta9.FieldWithMeta9Builder {
	
		protected String value9;
		protected MetaFields9.MetaFields9Builder meta9;
	
		public FieldWithMeta9BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("value9")
		public String getValue9() {
			return value9;
		}
		
		@Override
		@RosettaAttribute("meta9")
		public MetaFields9.MetaFields9Builder getMeta9() {
			return meta9;
		}
		
		@Override
		public MetaFields9.MetaFields9Builder getOrCreateMeta9() {
			MetaFields9.MetaFields9Builder result;
			if (meta9!=null) {
				result = meta9;
			}
			else {
				result = meta9 = MetaFields9.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("value9")
		public FieldWithMeta9.FieldWithMeta9Builder setValue9(String value9) {
			this.value9 = value9==null?null:value9;
			return this;
		}
		@Override
		@RosettaAttribute("meta9")
		public FieldWithMeta9.FieldWithMeta9Builder setMeta9(MetaFields9 meta9) {
			this.meta9 = meta9==null?null:meta9.toBuilder();
			return this;
		}
		
		@Override
		public FieldWithMeta9 build() {
			return new FieldWithMeta9.FieldWithMeta9Impl(this);
		}
		
		@Override
		public FieldWithMeta9.FieldWithMeta9Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public FieldWithMeta9.FieldWithMeta9Builder prune() {
			if (meta9!=null && !meta9.prune().hasData()) meta9 = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getValue9()!=null) return true;
			if (getMeta9()!=null && getMeta9().hasData()) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public FieldWithMeta9.FieldWithMeta9Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			FieldWithMeta9.FieldWithMeta9Builder o = (FieldWithMeta9.FieldWithMeta9Builder) other;
			
			merger.mergeRosetta(getMeta9(), o.getMeta9(), this::setMeta9);
			
			merger.mergeBasic(getValue9(), o.getValue9(), this::setValue9);
			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;
		
			FieldWithMeta9 _that = getType().cast(o);
		
			if (!Objects.equals(value9, _that.getValue9())) return false;
			if (!Objects.equals(meta9, _that.getMeta9())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (value9 != null ? value9.hashCode() : 0);
			_result = 31 * _result + (meta9 != null ? meta9.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "FieldWithMeta9Builder {" +
				"value9=" + this.value9 + ", " +
				"meta9=" + this.meta9 +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy