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

com.rosetta.testconditional.model.W19_3 Maven / Gradle / Ivy

There is a newer version: 11.25.1
Show newest version
package com.rosetta.testconditional.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.model.metafields.FieldWithMetaString;
import com.rosetta.model.metafields.FieldWithMetaString.FieldWithMetaStringBuilder;
import com.rosetta.testconditional.model.W19_3;
import com.rosetta.testconditional.model.W19_3.W19_3Builder;
import com.rosetta.testconditional.model.W19_3.W19_3BuilderImpl;
import com.rosetta.testconditional.model.W19_3.W19_3Impl;
import com.rosetta.testconditional.model.meta.W19_3Meta;
import java.util.Objects;

import static java.util.Optional.ofNullable;

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

	W19_3Meta metaData = new W19_3Meta();

	/*********************** Getter Methods  ***********************/
	FieldWithMetaString getXField();

	/*********************** Build Methods  ***********************/
	W19_3 build();
	
	W19_3.W19_3Builder toBuilder();
	
	static W19_3.W19_3Builder builder() {
		return new W19_3.W19_3BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return W19_3.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("xField"), processor, FieldWithMetaString.class, getXField());
	}
	

	/*********************** Builder Interface  ***********************/
	interface W19_3Builder extends W19_3, RosettaModelObjectBuilder {
		FieldWithMetaString.FieldWithMetaStringBuilder getOrCreateXField();
		FieldWithMetaString.FieldWithMetaStringBuilder getXField();
		W19_3.W19_3Builder setXField(FieldWithMetaString xField0);
		W19_3.W19_3Builder setXFieldValue(String xField1);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("xField"), processor, FieldWithMetaString.FieldWithMetaStringBuilder.class, getXField());
		}
		

		W19_3.W19_3Builder prune();
	}

	/*********************** Immutable Implementation of W19_3  ***********************/
	class W19_3Impl implements W19_3 {
		private final FieldWithMetaString xField;
		
		protected W19_3Impl(W19_3.W19_3Builder builder) {
			this.xField = ofNullable(builder.getXField()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("xField")
		public FieldWithMetaString getXField() {
			return xField;
		}
		
		@Override
		public W19_3 build() {
			return this;
		}
		
		@Override
		public W19_3.W19_3Builder toBuilder() {
			W19_3.W19_3Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(W19_3.W19_3Builder builder) {
			ofNullable(getXField()).ifPresent(builder::setXField);
		}

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

	/*********************** Builder Implementation of W19_3  ***********************/
	class W19_3BuilderImpl implements W19_3.W19_3Builder {
	
		protected FieldWithMetaString.FieldWithMetaStringBuilder xField;
	
		public W19_3BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("xField")
		public FieldWithMetaString.FieldWithMetaStringBuilder getXField() {
			return xField;
		}
		
		@Override
		public FieldWithMetaString.FieldWithMetaStringBuilder getOrCreateXField() {
			FieldWithMetaString.FieldWithMetaStringBuilder result;
			if (xField!=null) {
				result = xField;
			}
			else {
				result = xField = FieldWithMetaString.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("xField")
		public W19_3.W19_3Builder setXField(FieldWithMetaString xField) {
			this.xField = xField==null?null:xField.toBuilder();
			return this;
		}
		@Override
		public W19_3.W19_3Builder setXFieldValue(String xField) {
			this.getOrCreateXField().setValue(xField);
			return this;
		}
		
		@Override
		public W19_3 build() {
			return new W19_3.W19_3Impl(this);
		}
		
		@Override
		public W19_3.W19_3Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public W19_3.W19_3Builder prune() {
			if (xField!=null && !xField.prune().hasData()) xField = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getXField()!=null) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public W19_3.W19_3Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			W19_3.W19_3Builder o = (W19_3.W19_3Builder) other;
			
			merger.mergeRosetta(getXField(), o.getXField(), this::setXField);
			
			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;
		
			W19_3 _that = getType().cast(o);
		
			if (!Objects.equals(xField, _that.getXField())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (xField != null ? xField.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "W19_3Builder {" +
				"xField=" + this.xField +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy