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

com.rosetta.jsonparsingtests.model.BespokeProvisions Maven / Gradle / Ivy

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

import com.rosetta.jsonparsingtests.model.BespokeProvisions;
import com.rosetta.jsonparsingtests.model.BespokeProvisions.BespokeProvisionsBuilder;
import com.rosetta.jsonparsingtests.model.BespokeProvisions.BespokeProvisionsBuilderImpl;
import com.rosetta.jsonparsingtests.model.BespokeProvisions.BespokeProvisionsImpl;
import com.rosetta.jsonparsingtests.model.meta.BespokeProvisionsMeta;
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 java.util.Objects;

import static java.util.Optional.ofNullable;

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

	BespokeProvisionsMeta metaData = new BespokeProvisionsMeta();

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

	/*********************** Build Methods  ***********************/
	BespokeProvisions build();
	
	BespokeProvisions.BespokeProvisionsBuilder toBuilder();
	
	static BespokeProvisions.BespokeProvisionsBuilder builder() {
		return new BespokeProvisions.BespokeProvisionsBuilderImpl();
	}

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

	/*********************** Builder Interface  ***********************/
	interface BespokeProvisionsBuilder extends BespokeProvisions, RosettaModelObjectBuilder {
		BespokeProvisions.BespokeProvisionsBuilder setAField(String aField);

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

		BespokeProvisions.BespokeProvisionsBuilder prune();
	}

	/*********************** Immutable Implementation of BespokeProvisions  ***********************/
	class BespokeProvisionsImpl implements BespokeProvisions {
		private final String aField;
		
		protected BespokeProvisionsImpl(BespokeProvisions.BespokeProvisionsBuilder builder) {
			this.aField = builder.getAField();
		}
		
		@Override
		@RosettaAttribute("aField")
		public String getAField() {
			return aField;
		}
		
		@Override
		public BespokeProvisions build() {
			return this;
		}
		
		@Override
		public BespokeProvisions.BespokeProvisionsBuilder toBuilder() {
			BespokeProvisions.BespokeProvisionsBuilder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(BespokeProvisions.BespokeProvisionsBuilder builder) {
			ofNullable(getAField()).ifPresent(builder::setAField);
		}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy