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

annotations.io.alauda.kubernetes.api.model.ObjectMetaFluentImpl Maven / Gradle / Ivy

There is a newer version: 0.2.12
Show newest version
package io.alauda.kubernetes.api.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import javax.validation.constraints.Size;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.alauda.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import io.alauda.kubernetes.api.builder.Predicate;
import java.util.LinkedHashMap;
import java.lang.Deprecated;
import io.alauda.kubernetes.api.builder.BaseFluent;
import java.util.List;
import java.lang.Boolean;
import javax.validation.constraints.Pattern;
import javax.validation.Valid;
import java.lang.Long;
import java.util.Collection;
import java.lang.Object;
import java.util.Map;

public class ObjectMetaFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements ObjectMetaFluent{

    private Map annotations = new LinkedHashMap();
    private String clusterName;
    private String creationTimestamp;
    private Long deletionGracePeriodSeconds;
    private String deletionTimestamp;
    private List finalizers = new ArrayList();
    private String generateName;
    private Long generation;
    private InitializersBuilder initializers;
    private Map labels = new LinkedHashMap();
    private String name;
    private String namespace;
    private List ownerReferences =  new ArrayList();
    private String resourceVersion;
    private String selfLink;
    private String uid;

    public ObjectMetaFluentImpl(){
    }
    public ObjectMetaFluentImpl(ObjectMeta instance){
            this.withAnnotations(instance.getAnnotations()); 
            this.withClusterName(instance.getClusterName()); 
            this.withCreationTimestamp(instance.getCreationTimestamp()); 
            this.withDeletionGracePeriodSeconds(instance.getDeletionGracePeriodSeconds()); 
            this.withDeletionTimestamp(instance.getDeletionTimestamp()); 
            this.withFinalizers(instance.getFinalizers()); 
            this.withGenerateName(instance.getGenerateName()); 
            this.withGeneration(instance.getGeneration()); 
            this.withInitializers(instance.getInitializers()); 
            this.withLabels(instance.getLabels()); 
            this.withName(instance.getName()); 
            this.withNamespace(instance.getNamespace()); 
            this.withOwnerReferences(instance.getOwnerReferences()); 
            this.withResourceVersion(instance.getResourceVersion()); 
            this.withSelfLink(instance.getSelfLink()); 
            this.withUid(instance.getUid()); 
    }

    public A addToAnnotations(String key,String value){
            if(key != null && value != null) {this.annotations.put(key, value);} return (A)this;
    }

    public A addToAnnotations(Map map){
            if(map != null) { this.annotations.putAll(map);} return (A)this;
    }

    public A removeFromAnnotations(String key){
            if(key != null) {this.annotations.remove(key);} return (A)this;
    }

    public A removeFromAnnotations(Map map){
            if(map != null) { for(Object key : map.keySet()) {this.annotations.remove(key);}} return (A)this;
    }

    public Map getAnnotations(){
            return this.annotations;
    }

    public A withAnnotations(Map annotations){
            this.annotations.clear();
            if (annotations != null) {this.annotations.putAll(annotations);} return (A) this;
    }

    public Boolean hasAnnotations(){
            return this.annotations!=null;
    }

    public String getClusterName(){
            return this.clusterName;
    }

    public A withClusterName(String clusterName){
            this.clusterName=clusterName; return (A) this;
    }

    public Boolean hasClusterName(){
            return this.clusterName!=null;
    }

    public String getCreationTimestamp(){
            return this.creationTimestamp;
    }

    public A withCreationTimestamp(String creationTimestamp){
            this.creationTimestamp=creationTimestamp; return (A) this;
    }

    public Boolean hasCreationTimestamp(){
            return this.creationTimestamp!=null;
    }

    public Long getDeletionGracePeriodSeconds(){
            return this.deletionGracePeriodSeconds;
    }

    public A withDeletionGracePeriodSeconds(Long deletionGracePeriodSeconds){
            this.deletionGracePeriodSeconds=deletionGracePeriodSeconds; return (A) this;
    }

    public Boolean hasDeletionGracePeriodSeconds(){
            return this.deletionGracePeriodSeconds!=null;
    }

    public String getDeletionTimestamp(){
            return this.deletionTimestamp;
    }

    public A withDeletionTimestamp(String deletionTimestamp){
            this.deletionTimestamp=deletionTimestamp; return (A) this;
    }

    public Boolean hasDeletionTimestamp(){
            return this.deletionTimestamp!=null;
    }

    public A addToFinalizers(int index,String item){
            this.finalizers.add(index, item); return (A)this;
    }

    public A setToFinalizers(int index,String item){
            this.finalizers.set(index, item); return (A)this;
    }

    public A addToFinalizers(String... items){
            for (String item : items) {this.finalizers.add(item);} return (A)this;
    }

    public A addAllToFinalizers(Collection items){
            for (String item : items) {this.finalizers.add(item);} return (A)this;
    }

    public A removeFromFinalizers(String... items){
            for (String item : items) {this.finalizers.remove(item);} return (A)this;
    }

    public A removeAllFromFinalizers(Collection items){
            for (String item : items) {this.finalizers.remove(item);} return (A)this;
    }

    public List getFinalizers(){
            return this.finalizers;
    }

    public String getFinalizer(int index){
            return this.finalizers.get(index);
    }

    public String getFirstFinalizer(){
            return this.finalizers.get(0);
    }

    public String getLastFinalizer(){
            return this.finalizers.get(finalizers.size() - 1);
    }

    public String getMatchingFinalizer(io.alauda.kubernetes.api.builder.Predicate predicate){
            for (String item: finalizers) { if(predicate.apply(item)){return item;} } return null;
    }

    public A withFinalizers(List finalizers){
            this.finalizers.clear();
            if (finalizers != null) {for (String item : finalizers){this.addToFinalizers(item);}} return (A) this;
    }

    public A withFinalizers(String... finalizers){
            this.finalizers.clear(); if (finalizers != null) {for (String item :finalizers){ this.addToFinalizers(item);}} return (A) this;
    }

    public Boolean hasFinalizers(){
            return finalizers!= null && !finalizers.isEmpty();
    }

    public String getGenerateName(){
            return this.generateName;
    }

    public A withGenerateName(String generateName){
            this.generateName=generateName; return (A) this;
    }

    public Boolean hasGenerateName(){
            return this.generateName!=null;
    }

    public Long getGeneration(){
            return this.generation;
    }

    public A withGeneration(Long generation){
            this.generation=generation; return (A) this;
    }

    public Boolean hasGeneration(){
            return this.generation!=null;
    }

    
/**
 * This method has been deprecated, please use method buildInitializers instead.
 */
@Deprecated public Initializers getInitializers(){
            return this.initializers!=null?this.initializers.build():null;
    }

    public Initializers buildInitializers(){
            return this.initializers!=null?this.initializers.build():null;
    }

    public A withInitializers(Initializers initializers){
            _visitables.remove(this.initializers);
            if (initializers!=null){ this.initializers= new InitializersBuilder(initializers); _visitables.add(this.initializers);} return (A) this;
    }

    public Boolean hasInitializers(){
            return this.initializers!=null;
    }

    public ObjectMetaFluent.InitializersNested withNewInitializers(){
            return new InitializersNestedImpl();
    }

    public ObjectMetaFluent.InitializersNested withNewInitializersLike(Initializers item){
            return new InitializersNestedImpl(item);
    }

    public ObjectMetaFluent.InitializersNested editInitializers(){
            return withNewInitializersLike(getInitializers());
    }

    public ObjectMetaFluent.InitializersNested editOrNewInitializers(){
            return withNewInitializersLike(getInitializers() != null ? getInitializers(): new InitializersBuilder().build());
    }

    public ObjectMetaFluent.InitializersNested editOrNewInitializersLike(Initializers item){
            return withNewInitializersLike(getInitializers() != null ? getInitializers(): item);
    }

    public A addToLabels(String key,String value){
            if(key != null && value != null) {this.labels.put(key, value);} return (A)this;
    }

    public A addToLabels(Map map){
            if(map != null) { this.labels.putAll(map);} return (A)this;
    }

    public A removeFromLabels(String key){
            if(key != null) {this.labels.remove(key);} return (A)this;
    }

    public A removeFromLabels(Map map){
            if(map != null) { for(Object key : map.keySet()) {this.labels.remove(key);}} return (A)this;
    }

    public Map getLabels(){
            return this.labels;
    }

    public A withLabels(Map labels){
            this.labels.clear();
            if (labels != null) {this.labels.putAll(labels);} return (A) this;
    }

    public Boolean hasLabels(){
            return this.labels!=null;
    }

    public String getName(){
            return this.name;
    }

    public A withName(String name){
            this.name=name; return (A) this;
    }

    public Boolean hasName(){
            return this.name!=null;
    }

    public String getNamespace(){
            return this.namespace;
    }

    public A withNamespace(String namespace){
            this.namespace=namespace; return (A) this;
    }

    public Boolean hasNamespace(){
            return this.namespace!=null;
    }

    public A addToOwnerReferences(int index,OwnerReference item){
            OwnerReferenceBuilder builder = new OwnerReferenceBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.ownerReferences.add(index >= 0 ? index : ownerReferences.size(), builder); return (A)this;
    }

    public A setToOwnerReferences(int index,OwnerReference item){
            OwnerReferenceBuilder builder = new OwnerReferenceBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= ownerReferences.size()) { ownerReferences.add(builder); } else { ownerReferences.set(index, builder);}
             return (A)this;
    }

    public A addToOwnerReferences(OwnerReference... items){
            for (OwnerReference item : items) {OwnerReferenceBuilder builder = new OwnerReferenceBuilder(item);_visitables.add(builder);this.ownerReferences.add(builder);} return (A)this;
    }

    public A addAllToOwnerReferences(Collection items){
            for (OwnerReference item : items) {OwnerReferenceBuilder builder = new OwnerReferenceBuilder(item);_visitables.add(builder);this.ownerReferences.add(builder);} return (A)this;
    }

    public A removeFromOwnerReferences(OwnerReference... items){
            for (OwnerReference item : items) {OwnerReferenceBuilder builder = new OwnerReferenceBuilder(item);_visitables.remove(builder);this.ownerReferences.remove(builder);} return (A)this;
    }

    public A removeAllFromOwnerReferences(Collection items){
            for (OwnerReference item : items) {OwnerReferenceBuilder builder = new OwnerReferenceBuilder(item);_visitables.remove(builder);this.ownerReferences.remove(builder);} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildOwnerReferences instead.
 */
@Deprecated public List getOwnerReferences(){
            return build(ownerReferences);
    }

    public List buildOwnerReferences(){
            return build(ownerReferences);
    }

    public OwnerReference buildOwnerReference(int index){
            return this.ownerReferences.get(index).build();
    }

    public OwnerReference buildFirstOwnerReference(){
            return this.ownerReferences.get(0).build();
    }

    public OwnerReference buildLastOwnerReference(){
            return this.ownerReferences.get(ownerReferences.size() - 1).build();
    }

    public OwnerReference buildMatchingOwnerReference(io.alauda.kubernetes.api.builder.Predicate predicate){
            for (OwnerReferenceBuilder item: ownerReferences) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withOwnerReferences(List ownerReferences){
            _visitables.removeAll(this.ownerReferences);
            this.ownerReferences.clear();
            if (ownerReferences != null) {for (OwnerReference item : ownerReferences){this.addToOwnerReferences(item);}} return (A) this;
    }

    public A withOwnerReferences(OwnerReference... ownerReferences){
            this.ownerReferences.clear(); if (ownerReferences != null) {for (OwnerReference item :ownerReferences){ this.addToOwnerReferences(item);}} return (A) this;
    }

    public Boolean hasOwnerReferences(){
            return ownerReferences!= null && !ownerReferences.isEmpty();
    }

    public ObjectMetaFluent.OwnerReferencesNested addNewOwnerReference(){
            return new OwnerReferencesNestedImpl();
    }

    public ObjectMetaFluent.OwnerReferencesNested addNewOwnerReferenceLike(OwnerReference item){
            return new OwnerReferencesNestedImpl(-1, item);
    }

    public ObjectMetaFluent.OwnerReferencesNested setNewOwnerReferenceLike(int index,OwnerReference item){
            return new OwnerReferencesNestedImpl(index, item);
    }

    public ObjectMetaFluent.OwnerReferencesNested editOwnerReference(int index){
            if (ownerReferences.size() <= index) throw new RuntimeException("Can't edit ownerReferences. Index exceeds size.");
            return setNewOwnerReferenceLike(index, buildOwnerReference(index));
    }

    public ObjectMetaFluent.OwnerReferencesNested editFirstOwnerReference(){
            if (ownerReferences.size() == 0) throw new RuntimeException("Can't edit first ownerReferences. The list is empty.");
            return setNewOwnerReferenceLike(0, buildOwnerReference(0));
    }

    public ObjectMetaFluent.OwnerReferencesNested editLastOwnerReference(){
            int index = ownerReferences.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last ownerReferences. The list is empty.");
            return setNewOwnerReferenceLike(index, buildOwnerReference(index));
    }

    public ObjectMetaFluent.OwnerReferencesNested editMatchingOwnerReference(io.alauda.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i extends InitializersFluentImpl> implements ObjectMetaFluent.InitializersNested,io.alauda.kubernetes.api.builder.Nested{

            private final InitializersBuilder builder;
    
            InitializersNestedImpl(Initializers item){
                    this.builder = new InitializersBuilder(this, item);
            }
            InitializersNestedImpl(){
                    this.builder = new InitializersBuilder(this);
            }
    
    public N and(){
            return (N) ObjectMetaFluentImpl.this.withInitializers(builder.build());
    }
    public N endInitializers(){
            return and();
    }

}
    public class OwnerReferencesNestedImpl extends OwnerReferenceFluentImpl> implements ObjectMetaFluent.OwnerReferencesNested,io.alauda.kubernetes.api.builder.Nested{

            private final OwnerReferenceBuilder builder;
        private final int index;
    
            OwnerReferencesNestedImpl(int index,OwnerReference item){
                    this.index = index;
                    this.builder = new OwnerReferenceBuilder(this, item);
            }
            OwnerReferencesNestedImpl(){
                    this.index = -1;
                    this.builder = new OwnerReferenceBuilder(this);
            }
    
    public N and(){
            return (N) ObjectMetaFluentImpl.this.setToOwnerReferences(index, builder.build());
    }
    public N endOwnerReference(){
            return and();
    }

}


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy