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

com.rosetta.testconditional.model.W11 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.testconditional.model.W11;
import com.rosetta.testconditional.model.W11.W11Builder;
import com.rosetta.testconditional.model.W11.W11BuilderImpl;
import com.rosetta.testconditional.model.W11.W11Impl;
import com.rosetta.testconditional.model.meta.W11Meta;
import java.util.Objects;

import static java.util.Optional.ofNullable;

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

	W11Meta metaData = new W11Meta();

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

	/*********************** Build Methods  ***********************/
	W11 build();
	
	W11.W11Builder toBuilder();
	
	static W11.W11Builder builder() {
		return new W11.W11BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return W11.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processor.processBasic(path.newSubPath("id"), String.class, getId(), this);
	}
	

	/*********************** Builder Interface  ***********************/
	interface W11Builder extends W11, RosettaModelObjectBuilder {
		W11.W11Builder setId(String id);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processor.processBasic(path.newSubPath("id"), String.class, getId(), this);
		}
		

		W11.W11Builder prune();
	}

	/*********************** Immutable Implementation of W11  ***********************/
	class W11Impl implements W11 {
		private final String id;
		
		protected W11Impl(W11.W11Builder builder) {
			this.id = builder.getId();
		}
		
		@Override
		@RosettaAttribute("id")
		public String getId() {
			return id;
		}
		
		@Override
		public W11 build() {
			return this;
		}
		
		@Override
		public W11.W11Builder toBuilder() {
			W11.W11Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(W11.W11Builder builder) {
			ofNullable(getId()).ifPresent(builder::setId);
		}

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

	/*********************** Builder Implementation of W11  ***********************/
	class W11BuilderImpl implements W11.W11Builder {
	
		protected String id;
	
		public W11BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("id")
		public String getId() {
			return id;
		}
		
		@Override
		@RosettaAttribute("id")
		public W11.W11Builder setId(String id) {
			this.id = id==null?null:id;
			return this;
		}
		
		@Override
		public W11 build() {
			return new W11.W11Impl(this);
		}
		
		@Override
		public W11.W11Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public W11.W11Builder prune() {
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getId()!=null) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public W11.W11Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			W11.W11Builder o = (W11.W11Builder) other;
			
			
			merger.mergeBasic(getId(), o.getId(), this::setId);
			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;
		
			W11 _that = getType().cast(o);
		
			if (!Objects.equals(id, _that.getId())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (id != null ? id.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "W11Builder {" +
				"id=" + this.id +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy