annotations.io.alauda.kubernetes.api.model.CodeRepoBindingAccountFluentImpl Maven / Gradle / Ivy
package io.alauda.kubernetes.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.alauda.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import io.alauda.kubernetes.api.builder.Predicate;
import java.lang.Deprecated;
import io.alauda.kubernetes.api.builder.BaseFluent;
import java.util.List;
import java.lang.Boolean;
import javax.validation.Valid;
import java.util.Collection;
import java.lang.Object;
public class CodeRepoBindingAccountFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements CodeRepoBindingAccountFluent{
private List owners = new ArrayList();
private SecretKeySetRefBuilder secret;
public CodeRepoBindingAccountFluentImpl(){
}
public CodeRepoBindingAccountFluentImpl(CodeRepoBindingAccount instance){
this.withOwners(instance.getOwners());
this.withSecret(instance.getSecret());
}
public A addToOwners(int index,CodeRepositoryOwnerSync item){
CodeRepositoryOwnerSyncBuilder builder = new CodeRepositoryOwnerSyncBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.owners.add(index >= 0 ? index : owners.size(), builder); return (A)this;
}
public A setToOwners(int index,CodeRepositoryOwnerSync item){
CodeRepositoryOwnerSyncBuilder builder = new CodeRepositoryOwnerSyncBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= owners.size()) { owners.add(builder); } else { owners.set(index, builder);}
return (A)this;
}
public A addToOwners(CodeRepositoryOwnerSync... items){
for (CodeRepositoryOwnerSync item : items) {CodeRepositoryOwnerSyncBuilder builder = new CodeRepositoryOwnerSyncBuilder(item);_visitables.add(builder);this.owners.add(builder);} return (A)this;
}
public A addAllToOwners(Collection items){
for (CodeRepositoryOwnerSync item : items) {CodeRepositoryOwnerSyncBuilder builder = new CodeRepositoryOwnerSyncBuilder(item);_visitables.add(builder);this.owners.add(builder);} return (A)this;
}
public A removeFromOwners(CodeRepositoryOwnerSync... items){
for (CodeRepositoryOwnerSync item : items) {CodeRepositoryOwnerSyncBuilder builder = new CodeRepositoryOwnerSyncBuilder(item);_visitables.remove(builder);this.owners.remove(builder);} return (A)this;
}
public A removeAllFromOwners(Collection items){
for (CodeRepositoryOwnerSync item : items) {CodeRepositoryOwnerSyncBuilder builder = new CodeRepositoryOwnerSyncBuilder(item);_visitables.remove(builder);this.owners.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildOwners instead.
*/
@Deprecated public List getOwners(){
return build(owners);
}
public List buildOwners(){
return build(owners);
}
public CodeRepositoryOwnerSync buildOwner(int index){
return this.owners.get(index).build();
}
public CodeRepositoryOwnerSync buildFirstOwner(){
return this.owners.get(0).build();
}
public CodeRepositoryOwnerSync buildLastOwner(){
return this.owners.get(owners.size() - 1).build();
}
public CodeRepositoryOwnerSync buildMatchingOwner(io.alauda.kubernetes.api.builder.Predicate predicate){
for (CodeRepositoryOwnerSyncBuilder item: owners) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withOwners(List owners){
_visitables.removeAll(this.owners);
this.owners.clear();
if (owners != null) {for (CodeRepositoryOwnerSync item : owners){this.addToOwners(item);}} return (A) this;
}
public A withOwners(CodeRepositoryOwnerSync... owners){
this.owners.clear(); if (owners != null) {for (CodeRepositoryOwnerSync item :owners){ this.addToOwners(item);}} return (A) this;
}
public Boolean hasOwners(){
return owners!= null && !owners.isEmpty();
}
public CodeRepoBindingAccountFluent.OwnersNested addNewOwner(){
return new OwnersNestedImpl();
}
public CodeRepoBindingAccountFluent.OwnersNested addNewOwnerLike(CodeRepositoryOwnerSync item){
return new OwnersNestedImpl(-1, item);
}
public CodeRepoBindingAccountFluent.OwnersNested setNewOwnerLike(int index,CodeRepositoryOwnerSync item){
return new OwnersNestedImpl(index, item);
}
public CodeRepoBindingAccountFluent.OwnersNested editOwner(int index){
if (owners.size() <= index) throw new RuntimeException("Can't edit owners. Index exceeds size.");
return setNewOwnerLike(index, buildOwner(index));
}
public CodeRepoBindingAccountFluent.OwnersNested editFirstOwner(){
if (owners.size() == 0) throw new RuntimeException("Can't edit first owners. The list is empty.");
return setNewOwnerLike(0, buildOwner(0));
}
public CodeRepoBindingAccountFluent.OwnersNested editLastOwner(){
int index = owners.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last owners. The list is empty.");
return setNewOwnerLike(index, buildOwner(index));
}
public CodeRepoBindingAccountFluent.OwnersNested editMatchingOwner(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i withNewSecret(){
return new SecretNestedImpl();
}
public CodeRepoBindingAccountFluent.SecretNested withNewSecretLike(SecretKeySetRef item){
return new SecretNestedImpl(item);
}
public CodeRepoBindingAccountFluent.SecretNested editSecret(){
return withNewSecretLike(getSecret());
}
public CodeRepoBindingAccountFluent.SecretNested editOrNewSecret(){
return withNewSecretLike(getSecret() != null ? getSecret(): new SecretKeySetRefBuilder().build());
}
public CodeRepoBindingAccountFluent.SecretNested editOrNewSecretLike(SecretKeySetRef item){
return withNewSecretLike(getSecret() != null ? getSecret(): item);
}
public A withNewSecret(String apiTokenKey,String name,String namespace,String usernameKey){
return (A)withSecret(new SecretKeySetRef(apiTokenKey, name, namespace, usernameKey));
}
public boolean equals(Object o){
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
CodeRepoBindingAccountFluentImpl that = (CodeRepoBindingAccountFluentImpl) o;
if (owners != null ? !owners.equals(that.owners) :that.owners != null) return false;
if (secret != null ? !secret.equals(that.secret) :that.secret != null) return false;
return true;
}
public class OwnersNestedImpl extends CodeRepositoryOwnerSyncFluentImpl> implements CodeRepoBindingAccountFluent.OwnersNested,io.alauda.kubernetes.api.builder.Nested{
private final CodeRepositoryOwnerSyncBuilder builder;
private final int index;
OwnersNestedImpl(int index,CodeRepositoryOwnerSync item){
this.index = index;
this.builder = new CodeRepositoryOwnerSyncBuilder(this, item);
}
OwnersNestedImpl(){
this.index = -1;
this.builder = new CodeRepositoryOwnerSyncBuilder(this);
}
public N and(){
return (N) CodeRepoBindingAccountFluentImpl.this.setToOwners(index, builder.build());
}
public N endOwner(){
return and();
}
}
public class SecretNestedImpl extends SecretKeySetRefFluentImpl> implements CodeRepoBindingAccountFluent.SecretNested,io.alauda.kubernetes.api.builder.Nested{
private final SecretKeySetRefBuilder builder;
SecretNestedImpl(SecretKeySetRef item){
this.builder = new SecretKeySetRefBuilder(this, item);
}
SecretNestedImpl(){
this.builder = new SecretKeySetRefBuilder(this);
}
public N and(){
return (N) CodeRepoBindingAccountFluentImpl.this.withSecret(builder.build());
}
public N endSecret(){
return and();
}
}
}