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

io.fabric8.kubernetes.api.model.flowcontrol.v1beta2.SubjectFluent Maven / Gradle / Ivy

There is a newer version: 7.0.1
Show newest version
package io.fabric8.kubernetes.api.model.flowcontrol.v1beta2;

import java.lang.SuppressWarnings;
import io.fabric8.kubernetes.api.builder.Nested;
import java.lang.String;
import java.util.LinkedHashMap;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.lang.Object;
import java.util.Map;

/**
 * Generated
 */
@SuppressWarnings("unchecked")
public class SubjectFluent> extends BaseFluent{
  public SubjectFluent() {
  }
  
  public SubjectFluent(Subject instance) {
    this.copyInstance(instance);
  }
  private GroupSubjectBuilder group;
  private String kind;
  private ServiceAccountSubjectBuilder serviceAccount;
  private UserSubjectBuilder user;
  private Map additionalProperties;
  
  protected void copyInstance(Subject instance) {
    instance = (instance != null ? instance : new Subject());
    if (instance != null) {
          this.withGroup(instance.getGroup());
          this.withKind(instance.getKind());
          this.withServiceAccount(instance.getServiceAccount());
          this.withUser(instance.getUser());
          this.withAdditionalProperties(instance.getAdditionalProperties());
        }
  }
  
  public GroupSubject buildGroup() {
    return this.group != null ? this.group.build() : null;
  }
  
  public A withGroup(GroupSubject group) {
    this._visitables.remove("group");
    if (group != null) {
        this.group = new GroupSubjectBuilder(group);
        this._visitables.get("group").add(this.group);
    } else {
        this.group = null;
        this._visitables.get("group").remove(this.group);
    }
    return (A) this;
  }
  
  public boolean hasGroup() {
    return this.group != null;
  }
  
  public A withNewGroup(String name) {
    return (A)withGroup(new GroupSubject(name));
  }
  
  public GroupNested withNewGroup() {
    return new GroupNested(null);
  }
  
  public GroupNested withNewGroupLike(GroupSubject item) {
    return new GroupNested(item);
  }
  
  public GroupNested editGroup() {
    return withNewGroupLike(java.util.Optional.ofNullable(buildGroup()).orElse(null));
  }
  
  public GroupNested editOrNewGroup() {
    return withNewGroupLike(java.util.Optional.ofNullable(buildGroup()).orElse(new GroupSubjectBuilder().build()));
  }
  
  public GroupNested editOrNewGroupLike(GroupSubject item) {
    return withNewGroupLike(java.util.Optional.ofNullable(buildGroup()).orElse(item));
  }
  
  public String getKind() {
    return this.kind;
  }
  
  public A withKind(String kind) {
    this.kind = kind;
    return (A) this;
  }
  
  public boolean hasKind() {
    return this.kind != null;
  }
  
  public ServiceAccountSubject buildServiceAccount() {
    return this.serviceAccount != null ? this.serviceAccount.build() : null;
  }
  
  public A withServiceAccount(ServiceAccountSubject serviceAccount) {
    this._visitables.remove("serviceAccount");
    if (serviceAccount != null) {
        this.serviceAccount = new ServiceAccountSubjectBuilder(serviceAccount);
        this._visitables.get("serviceAccount").add(this.serviceAccount);
    } else {
        this.serviceAccount = null;
        this._visitables.get("serviceAccount").remove(this.serviceAccount);
    }
    return (A) this;
  }
  
  public boolean hasServiceAccount() {
    return this.serviceAccount != null;
  }
  
  public A withNewServiceAccount(String name,String namespace) {
    return (A)withServiceAccount(new ServiceAccountSubject(name, namespace));
  }
  
  public ServiceAccountNested withNewServiceAccount() {
    return new ServiceAccountNested(null);
  }
  
  public ServiceAccountNested withNewServiceAccountLike(ServiceAccountSubject item) {
    return new ServiceAccountNested(item);
  }
  
  public ServiceAccountNested editServiceAccount() {
    return withNewServiceAccountLike(java.util.Optional.ofNullable(buildServiceAccount()).orElse(null));
  }
  
  public ServiceAccountNested editOrNewServiceAccount() {
    return withNewServiceAccountLike(java.util.Optional.ofNullable(buildServiceAccount()).orElse(new ServiceAccountSubjectBuilder().build()));
  }
  
  public ServiceAccountNested editOrNewServiceAccountLike(ServiceAccountSubject item) {
    return withNewServiceAccountLike(java.util.Optional.ofNullable(buildServiceAccount()).orElse(item));
  }
  
  public UserSubject buildUser() {
    return this.user != null ? this.user.build() : null;
  }
  
  public A withUser(UserSubject user) {
    this._visitables.remove("user");
    if (user != null) {
        this.user = new UserSubjectBuilder(user);
        this._visitables.get("user").add(this.user);
    } else {
        this.user = null;
        this._visitables.get("user").remove(this.user);
    }
    return (A) this;
  }
  
  public boolean hasUser() {
    return this.user != null;
  }
  
  public A withNewUser(String name) {
    return (A)withUser(new UserSubject(name));
  }
  
  public UserNested withNewUser() {
    return new UserNested(null);
  }
  
  public UserNested withNewUserLike(UserSubject item) {
    return new UserNested(item);
  }
  
  public UserNested editUser() {
    return withNewUserLike(java.util.Optional.ofNullable(buildUser()).orElse(null));
  }
  
  public UserNested editOrNewUser() {
    return withNewUserLike(java.util.Optional.ofNullable(buildUser()).orElse(new UserSubjectBuilder().build()));
  }
  
  public UserNested editOrNewUserLike(UserSubject item) {
    return withNewUserLike(java.util.Optional.ofNullable(buildUser()).orElse(item));
  }
  
  public A addToAdditionalProperties(String key,Object value) {
    if(this.additionalProperties == null && key != null && value != null) { this.additionalProperties = new LinkedHashMap(); }
    if(key != null && value != null) {this.additionalProperties.put(key, value);} return (A)this;
  }
  
  public A addToAdditionalProperties(Map map) {
    if(this.additionalProperties == null && map != null) { this.additionalProperties = new LinkedHashMap(); }
    if(map != null) { this.additionalProperties.putAll(map);} return (A)this;
  }
  
  public A removeFromAdditionalProperties(String key) {
    if(this.additionalProperties == null) { return (A) this; }
    if(key != null && this.additionalProperties != null) {this.additionalProperties.remove(key);} return (A)this;
  }
  
  public A removeFromAdditionalProperties(Map map) {
    if(this.additionalProperties == null) { return (A) this; }
    if(map != null) { for(Object key : map.keySet()) {if (this.additionalProperties != null){this.additionalProperties.remove(key);}}} return (A)this;
  }
  
  public Map getAdditionalProperties() {
    return this.additionalProperties;
  }
  
  public A withAdditionalProperties(Map additionalProperties) {
    if (additionalProperties == null) {
      this.additionalProperties = null;
    } else {
      this.additionalProperties = new LinkedHashMap(additionalProperties);
    }
    return (A) this;
  }
  
  public boolean hasAdditionalProperties() {
    return this.additionalProperties != null;
  }
  
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    if (!super.equals(o)) return false;
    SubjectFluent that = (SubjectFluent) o;
    if (!java.util.Objects.equals(group, that.group)) return false;
    if (!java.util.Objects.equals(kind, that.kind)) return false;
    if (!java.util.Objects.equals(serviceAccount, that.serviceAccount)) return false;
    if (!java.util.Objects.equals(user, that.user)) return false;
    if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
    return true;
  }
  
  public int hashCode() {
    return java.util.Objects.hash(group,  kind,  serviceAccount,  user,  additionalProperties,  super.hashCode());
  }
  
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (group != null) { sb.append("group:"); sb.append(group + ","); }
    if (kind != null) { sb.append("kind:"); sb.append(kind + ","); }
    if (serviceAccount != null) { sb.append("serviceAccount:"); sb.append(serviceAccount + ","); }
    if (user != null) { sb.append("user:"); sb.append(user + ","); }
    if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
    sb.append("}");
    return sb.toString();
  }
  public class GroupNested extends GroupSubjectFluent> implements Nested{
    GroupNested(GroupSubject item) {
      this.builder = new GroupSubjectBuilder(this, item);
    }
    GroupSubjectBuilder builder;
    
    public N and() {
      return (N) SubjectFluent.this.withGroup(builder.build());
    }
    
    public N endGroup() {
      return and();
    }
    
  
  }
  public class ServiceAccountNested extends ServiceAccountSubjectFluent> implements Nested{
    ServiceAccountNested(ServiceAccountSubject item) {
      this.builder = new ServiceAccountSubjectBuilder(this, item);
    }
    ServiceAccountSubjectBuilder builder;
    
    public N and() {
      return (N) SubjectFluent.this.withServiceAccount(builder.build());
    }
    
    public N endServiceAccount() {
      return and();
    }
    
  
  }
  public class UserNested extends UserSubjectFluent> implements Nested{
    UserNested(UserSubject item) {
      this.builder = new UserSubjectBuilder(this, item);
    }
    UserSubjectBuilder builder;
    
    public N and() {
      return (N) SubjectFluent.this.withUser(builder.build());
    }
    
    public N endUser() {
      return and();
    }
    
  
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy