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

openapitools.model.ChildB Maven / Gradle / Ivy

There is a newer version: 1.24.2
Show newest version
/*
 * Product Base Definitions
 * This component represents the Open API interface of the accounting service. 
 *
 * The version of the OpenAPI document: 0.0.1
 * Contact: [email protected]
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package openapitools.model;

import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import openapitools.model.BankAccount;
import openapitools.model.ParentClass;
import org.openapitools.jackson.nullable.JsonNullable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.openapitools.jackson.nullable.JsonNullable;
import java.util.NoSuchElementException;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import openapitools.JSON;


/**
 * Multi line class comment 
 */
@JsonPropertyOrder({
  ChildB.JSON_PROPERTY_CHILD_B_ATTRIBUTE,
  ChildB.JSON_PROPERTY_COMPOSITION
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.8.0")
@JsonIgnoreProperties(
  value = "objectType", // ignore manually set objectType, it will be automatically generated by Jackson during serialization
  allowSetters = true // allows the objectType to be set during deserialization
)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType", visible = true)
@JsonSubTypes({
  @JsonSubTypes.Type(value = ChildBB.class, name = "ChildBB"),
})

public class ChildB extends ParentClass {
  public static final String JSON_PROPERTY_CHILD_B_ATTRIBUTE = "childBAttribute";
  private JsonNullable> childBAttribute = JsonNullable.>undefined();

  public static final String JSON_PROPERTY_COMPOSITION = "composition";
  private List composition = new ArrayList<>();

  public ChildB() { 
  }

  public ChildB childBAttribute(List childBAttribute) {
    this.childBAttribute = JsonNullable.>of(childBAttribute);
    return this;
  }

  public ChildB addChildBAttributeItem(Boolean childBAttributeItem) {
    if (this.childBAttribute == null || !this.childBAttribute.isPresent()) {
      this.childBAttribute = JsonNullable.>of(new ArrayList<>());
    }
    try {
      this.childBAttribute.get().add(childBAttributeItem);
    } catch (java.util.NoSuchElementException e) {
      // this can never happen, as we make sure above that the value is present
    }
    return this;
  }

  /**
   * A child attribute 
   * @return childBAttribute
   */
  @javax.annotation.Nullable
  @JsonIgnore

  public List getChildBAttribute() {
        return childBAttribute.orElse(null);
  }

  @JsonProperty(JSON_PROPERTY_CHILD_B_ATTRIBUTE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public JsonNullable> getChildBAttribute_JsonNullable() {
    return childBAttribute;
  }
  
  @JsonProperty(JSON_PROPERTY_CHILD_B_ATTRIBUTE)
  public void setChildBAttribute_JsonNullable(JsonNullable> childBAttribute) {
    this.childBAttribute = childBAttribute;
  }

  public void setChildBAttribute(List childBAttribute) {
    this.childBAttribute = JsonNullable.>of(childBAttribute);
  }


  public ChildB composition(List composition) {
    this.composition = composition;
    return this;
  }

  public ChildB addCompositionItem(ParentClass compositionItem) {
    if (this.composition == null) {
      this.composition = new ArrayList<>();
    }
    this.composition.add(compositionItem);
    return this;
  }

  /**
   * the composition 
   * @return composition
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_COMPOSITION)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public List getComposition() {
    return composition;
  }


  @JsonProperty(JSON_PROPERTY_COMPOSITION)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setComposition(List composition) {
    this.composition = composition;
  }


  /**
   * Return true if this ChildB object is equal to o.
   */
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    ChildB childB = (ChildB) o;
    return equalsNullable(this.childBAttribute, childB.childBAttribute) &&
        Objects.equals(this.composition, childB.composition) &&
        super.equals(o);
  }

  private static  boolean equalsNullable(JsonNullable a, JsonNullable b) {
    return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
  }

  @Override
  public int hashCode() {
    return Objects.hash(hashCodeNullable(childBAttribute), composition, super.hashCode());
  }

  private static  int hashCodeNullable(JsonNullable a) {
    if (a == null) {
      return 1;
    }
    return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class ChildB {\n");
    sb.append("    ").append(toIndentedString(super.toString())).append("\n");
    sb.append("    childBAttribute: ").append(toIndentedString(childBAttribute)).append("\n");
    sb.append("    composition: ").append(toIndentedString(composition)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }

  static {
    // Initialize and register the discriminator mappings.
    Map> mappings = new HashMap<>();
    mappings.put("ChildBB", ChildBB.class);
    mappings.put("ChildB", ChildB.class);
    JSON.registerDiscriminator(ChildB.class, "objectType", mappings);
  }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy