io.alauda.devops.api.model.UserFluentImpl Maven / Gradle / Ivy
package io.alauda.devops.api.model;
import io.alauda.kubernetes.api.model.ObjectMeta;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.alauda.kubernetes.api.model.ObjectMetaFluentImpl;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.alauda.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import io.alauda.kubernetes.api.model.validators.CheckObjectMeta;
import java.lang.String;
import io.alauda.kubernetes.api.model.ObjectMetaBuilder;
import javax.validation.constraints.NotNull;
import io.alauda.kubernetes.api.builder.Predicate;
import java.lang.Deprecated;
import javax.validation.Valid;
import io.alauda.kubernetes.api.builder.BaseFluent;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.Boolean;
public class UserFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements UserFluent{
private String apiVersion;
private String fullName;
private List groups = new ArrayList();
private List identities = new ArrayList();
private String kind;
private ObjectMetaBuilder metadata;
public UserFluentImpl(){
}
public UserFluentImpl(User instance){
this.withApiVersion(instance.getApiVersion());
this.withFullName(instance.getFullName());
this.withGroups(instance.getGroups());
this.withIdentities(instance.getIdentities());
this.withKind(instance.getKind());
this.withMetadata(instance.getMetadata());
}
public String getApiVersion(){
return this.apiVersion;
}
public A withApiVersion(String apiVersion){
this.apiVersion=apiVersion; return (A) this;
}
public Boolean hasApiVersion(){
return this.apiVersion!=null;
}
public String getFullName(){
return this.fullName;
}
public A withFullName(String fullName){
this.fullName=fullName; return (A) this;
}
public Boolean hasFullName(){
return this.fullName!=null;
}
public A addToGroups(int index,String item){
this.groups.add(index, item); return (A)this;
}
public A setToGroups(int index,String item){
this.groups.set(index, item); return (A)this;
}
public A addToGroups(String... items){
for (String item : items) {this.groups.add(item);} return (A)this;
}
public A addAllToGroups(Collection items){
for (String item : items) {this.groups.add(item);} return (A)this;
}
public A removeFromGroups(String... items){
for (String item : items) {this.groups.remove(item);} return (A)this;
}
public A removeAllFromGroups(Collection items){
for (String item : items) {this.groups.remove(item);} return (A)this;
}
public List getGroups(){
return this.groups;
}
public String getGroup(int index){
return this.groups.get(index);
}
public String getFirstGroup(){
return this.groups.get(0);
}
public String getLastGroup(){
return this.groups.get(groups.size() - 1);
}
public String getMatchingGroup(io.alauda.kubernetes.api.builder.Predicate predicate){
for (String item: groups) { if(predicate.apply(item)){return item;} } return null;
}
public A withGroups(List groups){
this.groups.clear();
if (groups != null) {for (String item : groups){this.addToGroups(item);}} return (A) this;
}
public A withGroups(String... groups){
this.groups.clear(); if (groups != null) {for (String item :groups){ this.addToGroups(item);}} return (A) this;
}
public Boolean hasGroups(){
return groups!= null && !groups.isEmpty();
}
public A addToIdentities(int index,String item){
this.identities.add(index, item); return (A)this;
}
public A setToIdentities(int index,String item){
this.identities.set(index, item); return (A)this;
}
public A addToIdentities(String... items){
for (String item : items) {this.identities.add(item);} return (A)this;
}
public A addAllToIdentities(Collection items){
for (String item : items) {this.identities.add(item);} return (A)this;
}
public A removeFromIdentities(String... items){
for (String item : items) {this.identities.remove(item);} return (A)this;
}
public A removeAllFromIdentities(Collection items){
for (String item : items) {this.identities.remove(item);} return (A)this;
}
public List getIdentities(){
return this.identities;
}
public String getIdentity(int index){
return this.identities.get(index);
}
public String getFirstIdentity(){
return this.identities.get(0);
}
public String getLastIdentity(){
return this.identities.get(identities.size() - 1);
}
public String getMatchingIdentity(io.alauda.kubernetes.api.builder.Predicate predicate){
for (String item: identities) { if(predicate.apply(item)){return item;} } return null;
}
public A withIdentities(List identities){
this.identities.clear();
if (identities != null) {for (String item : identities){this.addToIdentities(item);}} return (A) this;
}
public A withIdentities(String... identities){
this.identities.clear(); if (identities != null) {for (String item :identities){ this.addToIdentities(item);}} return (A) this;
}
public Boolean hasIdentities(){
return identities!= null && !identities.isEmpty();
}
public String getKind(){
return this.kind;
}
public A withKind(String kind){
this.kind=kind; return (A) this;
}
public Boolean hasKind(){
return this.kind!=null;
}
/**
* This method has been deprecated, please use method buildMetadata instead.
*/
@Deprecated public ObjectMeta getMetadata(){
return this.metadata!=null?this.metadata.build():null;
}
public ObjectMeta buildMetadata(){
return this.metadata!=null?this.metadata.build():null;
}
public A withMetadata(ObjectMeta metadata){
_visitables.remove(this.metadata);
if (metadata!=null){ this.metadata= new ObjectMetaBuilder(metadata); _visitables.add(this.metadata);} return (A) this;
}
public Boolean hasMetadata(){
return this.metadata!=null;
}
public UserFluent.MetadataNested withNewMetadata(){
return new MetadataNestedImpl();
}
public UserFluent.MetadataNested withNewMetadataLike(ObjectMeta item){
return new MetadataNestedImpl(item);
}
public UserFluent.MetadataNested editMetadata(){
return withNewMetadataLike(getMetadata());
}
public UserFluent.MetadataNested editOrNewMetadata(){
return withNewMetadataLike(getMetadata() != null ? getMetadata(): new ObjectMetaBuilder().build());
}
public UserFluent.MetadataNested editOrNewMetadataLike(ObjectMeta item){
return withNewMetadataLike(getMetadata() != null ? getMetadata(): item);
}
public boolean equals(Object o){
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
UserFluentImpl that = (UserFluentImpl) o;
if (apiVersion != null ? !apiVersion.equals(that.apiVersion) :that.apiVersion != null) return false;
if (fullName != null ? !fullName.equals(that.fullName) :that.fullName != null) return false;
if (groups != null ? !groups.equals(that.groups) :that.groups != null) return false;
if (identities != null ? !identities.equals(that.identities) :that.identities != null) return false;
if (kind != null ? !kind.equals(that.kind) :that.kind != null) return false;
if (metadata != null ? !metadata.equals(that.metadata) :that.metadata != null) return false;
return true;
}
public class MetadataNestedImpl extends ObjectMetaFluentImpl> implements UserFluent.MetadataNested,io.alauda.kubernetes.api.builder.Nested{
private final ObjectMetaBuilder builder;
MetadataNestedImpl(ObjectMeta item){
this.builder = new ObjectMetaBuilder(this, item);
}
MetadataNestedImpl(){
this.builder = new ObjectMetaBuilder(this);
}
public N and(){
return (N) UserFluentImpl.this.withMetadata(builder.build());
}
public N endMetadata(){
return and();
}
}
}