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

io.alauda.kubernetes.api.model.PipelineTaskArgumentFluentImpl 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 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 PipelineTaskArgumentFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements PipelineTaskArgumentFluent{

    private String _default;
    private PipelineTaskArgumentDisplayBuilder display;
    private String name;
    private List relation =  new ArrayList();
    private Boolean required;
    private PipelineTaskArgumentSchemaBuilder schema;
    private PipelineTaskArgumentValidationBuilder validation;

    public PipelineTaskArgumentFluentImpl(){
    }
    public PipelineTaskArgumentFluentImpl(PipelineTaskArgument instance){
            this.withDefault(instance.getDefault()); 
            this.withDisplay(instance.getDisplay()); 
            this.withName(instance.getName()); 
            this.withRelation(instance.getRelation()); 
            this.withRequired(instance.getRequired()); 
            this.withSchema(instance.getSchema()); 
            this.withValidation(instance.getValidation()); 
    }

    public String getDefault(){
            return this._default;
    }

    public A withDefault(String _default){
            this._default=_default; return (A) this;
    }

    public Boolean hasDefault(){
            return this._default!=null;
    }

    
/**
 * This method has been deprecated, please use method buildDisplay instead.
 */
@Deprecated public PipelineTaskArgumentDisplay getDisplay(){
            return this.display!=null?this.display.build():null;
    }

    public PipelineTaskArgumentDisplay buildDisplay(){
            return this.display!=null?this.display.build():null;
    }

    public A withDisplay(PipelineTaskArgumentDisplay display){
            _visitables.remove(this.display);
            if (display!=null){ this.display= new PipelineTaskArgumentDisplayBuilder(display); _visitables.add(this.display);} return (A) this;
    }

    public Boolean hasDisplay(){
            return this.display!=null;
    }

    public PipelineTaskArgumentFluent.DisplayNested withNewDisplay(){
            return new DisplayNestedImpl();
    }

    public PipelineTaskArgumentFluent.DisplayNested withNewDisplayLike(PipelineTaskArgumentDisplay item){
            return new DisplayNestedImpl(item);
    }

    public PipelineTaskArgumentFluent.DisplayNested editDisplay(){
            return withNewDisplayLike(getDisplay());
    }

    public PipelineTaskArgumentFluent.DisplayNested editOrNewDisplay(){
            return withNewDisplayLike(getDisplay() != null ? getDisplay(): new PipelineTaskArgumentDisplayBuilder().build());
    }

    public PipelineTaskArgumentFluent.DisplayNested editOrNewDisplayLike(PipelineTaskArgumentDisplay item){
            return withNewDisplayLike(getDisplay() != null ? getDisplay(): item);
    }

    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 A addToRelation(int index,PipelineTaskArgumentAction item){
            PipelineTaskArgumentActionBuilder builder = new PipelineTaskArgumentActionBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.relation.add(index >= 0 ? index : relation.size(), builder); return (A)this;
    }

    public A setToRelation(int index,PipelineTaskArgumentAction item){
            PipelineTaskArgumentActionBuilder builder = new PipelineTaskArgumentActionBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= relation.size()) { relation.add(builder); } else { relation.set(index, builder);}
             return (A)this;
    }

    public A addToRelation(PipelineTaskArgumentAction... items){
            for (PipelineTaskArgumentAction item : items) {PipelineTaskArgumentActionBuilder builder = new PipelineTaskArgumentActionBuilder(item);_visitables.add(builder);this.relation.add(builder);} return (A)this;
    }

    public A addAllToRelation(Collection items){
            for (PipelineTaskArgumentAction item : items) {PipelineTaskArgumentActionBuilder builder = new PipelineTaskArgumentActionBuilder(item);_visitables.add(builder);this.relation.add(builder);} return (A)this;
    }

    public A removeFromRelation(PipelineTaskArgumentAction... items){
            for (PipelineTaskArgumentAction item : items) {PipelineTaskArgumentActionBuilder builder = new PipelineTaskArgumentActionBuilder(item);_visitables.remove(builder);this.relation.remove(builder);} return (A)this;
    }

    public A removeAllFromRelation(Collection items){
            for (PipelineTaskArgumentAction item : items) {PipelineTaskArgumentActionBuilder builder = new PipelineTaskArgumentActionBuilder(item);_visitables.remove(builder);this.relation.remove(builder);} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildRelation instead.
 */
@Deprecated public List getRelation(){
            return build(relation);
    }

    public List buildRelation(){
            return build(relation);
    }

    public PipelineTaskArgumentAction buildRelation(int index){
            return this.relation.get(index).build();
    }

    public PipelineTaskArgumentAction buildFirstRelation(){
            return this.relation.get(0).build();
    }

    public PipelineTaskArgumentAction buildLastRelation(){
            return this.relation.get(relation.size() - 1).build();
    }

    public PipelineTaskArgumentAction buildMatchingRelation(io.alauda.kubernetes.api.builder.Predicate predicate){
            for (PipelineTaskArgumentActionBuilder item: relation) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withRelation(List relation){
            _visitables.removeAll(this.relation);
            this.relation.clear();
            if (relation != null) {for (PipelineTaskArgumentAction item : relation){this.addToRelation(item);}} return (A) this;
    }

    public A withRelation(PipelineTaskArgumentAction... relation){
            this.relation.clear(); if (relation != null) {for (PipelineTaskArgumentAction item :relation){ this.addToRelation(item);}} return (A) this;
    }

    public Boolean hasRelation(){
            return relation!= null && !relation.isEmpty();
    }

    public PipelineTaskArgumentFluent.RelationNested addNewRelation(){
            return new RelationNestedImpl();
    }

    public PipelineTaskArgumentFluent.RelationNested addNewRelationLike(PipelineTaskArgumentAction item){
            return new RelationNestedImpl(-1, item);
    }

    public PipelineTaskArgumentFluent.RelationNested setNewRelationLike(int index,PipelineTaskArgumentAction item){
            return new RelationNestedImpl(index, item);
    }

    public PipelineTaskArgumentFluent.RelationNested editRelation(int index){
            if (relation.size() <= index) throw new RuntimeException("Can't edit relation. Index exceeds size.");
            return setNewRelationLike(index, buildRelation(index));
    }

    public PipelineTaskArgumentFluent.RelationNested editFirstRelation(){
            if (relation.size() == 0) throw new RuntimeException("Can't edit first relation. The list is empty.");
            return setNewRelationLike(0, buildRelation(0));
    }

    public PipelineTaskArgumentFluent.RelationNested editLastRelation(){
            int index = relation.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last relation. The list is empty.");
            return setNewRelationLike(index, buildRelation(index));
    }

    public PipelineTaskArgumentFluent.RelationNested editMatchingRelation(io.alauda.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i withNewSchema(){
            return new SchemaNestedImpl();
    }

    public PipelineTaskArgumentFluent.SchemaNested withNewSchemaLike(PipelineTaskArgumentSchema item){
            return new SchemaNestedImpl(item);
    }

    public PipelineTaskArgumentFluent.SchemaNested editSchema(){
            return withNewSchemaLike(getSchema());
    }

    public PipelineTaskArgumentFluent.SchemaNested editOrNewSchema(){
            return withNewSchemaLike(getSchema() != null ? getSchema(): new PipelineTaskArgumentSchemaBuilder().build());
    }

    public PipelineTaskArgumentFluent.SchemaNested editOrNewSchemaLike(PipelineTaskArgumentSchema item){
            return withNewSchemaLike(getSchema() != null ? getSchema(): item);
    }

    public A withNewSchema(String type){
            return (A)withSchema(new PipelineTaskArgumentSchema(type));
    }

    
/**
 * This method has been deprecated, please use method buildValidation instead.
 */
@Deprecated public PipelineTaskArgumentValidation getValidation(){
            return this.validation!=null?this.validation.build():null;
    }

    public PipelineTaskArgumentValidation buildValidation(){
            return this.validation!=null?this.validation.build():null;
    }

    public A withValidation(PipelineTaskArgumentValidation validation){
            _visitables.remove(this.validation);
            if (validation!=null){ this.validation= new PipelineTaskArgumentValidationBuilder(validation); _visitables.add(this.validation);} return (A) this;
    }

    public Boolean hasValidation(){
            return this.validation!=null;
    }

    public PipelineTaskArgumentFluent.ValidationNested withNewValidation(){
            return new ValidationNestedImpl();
    }

    public PipelineTaskArgumentFluent.ValidationNested withNewValidationLike(PipelineTaskArgumentValidation item){
            return new ValidationNestedImpl(item);
    }

    public PipelineTaskArgumentFluent.ValidationNested editValidation(){
            return withNewValidationLike(getValidation());
    }

    public PipelineTaskArgumentFluent.ValidationNested editOrNewValidation(){
            return withNewValidationLike(getValidation() != null ? getValidation(): new PipelineTaskArgumentValidationBuilder().build());
    }

    public PipelineTaskArgumentFluent.ValidationNested editOrNewValidationLike(PipelineTaskArgumentValidation item){
            return withNewValidationLike(getValidation() != null ? getValidation(): item);
    }

    public A withNewValidation(String pattern){
            return (A)withValidation(new PipelineTaskArgumentValidation(pattern));
    }

    public boolean equals(Object o){
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            if (!super.equals(o)) return false;
            PipelineTaskArgumentFluentImpl that = (PipelineTaskArgumentFluentImpl) o;
            if (_default != null ? !_default.equals(that._default) :that._default != null) return false;
            if (display != null ? !display.equals(that.display) :that.display != null) return false;
            if (name != null ? !name.equals(that.name) :that.name != null) return false;
            if (relation != null ? !relation.equals(that.relation) :that.relation != null) return false;
            if (required != null ? !required.equals(that.required) :that.required != null) return false;
            if (schema != null ? !schema.equals(that.schema) :that.schema != null) return false;
            if (validation != null ? !validation.equals(that.validation) :that.validation != null) return false;
            return true;
    }


    public class DisplayNestedImpl extends PipelineTaskArgumentDisplayFluentImpl> implements PipelineTaskArgumentFluent.DisplayNested,io.alauda.kubernetes.api.builder.Nested{

            private final PipelineTaskArgumentDisplayBuilder builder;
    
            DisplayNestedImpl(PipelineTaskArgumentDisplay item){
                    this.builder = new PipelineTaskArgumentDisplayBuilder(this, item);
            }
            DisplayNestedImpl(){
                    this.builder = new PipelineTaskArgumentDisplayBuilder(this);
            }
    
    public N and(){
            return (N) PipelineTaskArgumentFluentImpl.this.withDisplay(builder.build());
    }
    public N endDisplay(){
            return and();
    }

}
    public class RelationNestedImpl extends PipelineTaskArgumentActionFluentImpl> implements PipelineTaskArgumentFluent.RelationNested,io.alauda.kubernetes.api.builder.Nested{

            private final PipelineTaskArgumentActionBuilder builder;
        private final int index;
    
            RelationNestedImpl(int index,PipelineTaskArgumentAction item){
                    this.index = index;
                    this.builder = new PipelineTaskArgumentActionBuilder(this, item);
            }
            RelationNestedImpl(){
                    this.index = -1;
                    this.builder = new PipelineTaskArgumentActionBuilder(this);
            }
    
    public N and(){
            return (N) PipelineTaskArgumentFluentImpl.this.setToRelation(index, builder.build());
    }
    public N endRelation(){
            return and();
    }

}
    public class SchemaNestedImpl extends PipelineTaskArgumentSchemaFluentImpl> implements PipelineTaskArgumentFluent.SchemaNested,io.alauda.kubernetes.api.builder.Nested{

            private final PipelineTaskArgumentSchemaBuilder builder;
    
            SchemaNestedImpl(PipelineTaskArgumentSchema item){
                    this.builder = new PipelineTaskArgumentSchemaBuilder(this, item);
            }
            SchemaNestedImpl(){
                    this.builder = new PipelineTaskArgumentSchemaBuilder(this);
            }
    
    public N and(){
            return (N) PipelineTaskArgumentFluentImpl.this.withSchema(builder.build());
    }
    public N endSchema(){
            return and();
    }

}
    public class ValidationNestedImpl extends PipelineTaskArgumentValidationFluentImpl> implements PipelineTaskArgumentFluent.ValidationNested,io.alauda.kubernetes.api.builder.Nested{

            private final PipelineTaskArgumentValidationBuilder builder;
    
            ValidationNestedImpl(PipelineTaskArgumentValidation item){
                    this.builder = new PipelineTaskArgumentValidationBuilder(this, item);
            }
            ValidationNestedImpl(){
                    this.builder = new PipelineTaskArgumentValidationBuilder(this);
            }
    
    public N and(){
            return (N) PipelineTaskArgumentFluentImpl.this.withValidation(builder.build());
    }
    public N endValidation(){
            return and();
    }

}


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy