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

annotations.io.alauda.kubernetes.api.model.PipelineHookFluentImpl 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 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 PipelineHookFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements PipelineHookFluent{

    private List events = new ArrayList();
    private PipelineHookHTTPRequestBuilder httpRequest;
    private String type;

    public PipelineHookFluentImpl(){
    }
    public PipelineHookFluentImpl(PipelineHook instance){
            this.withEvents(instance.getEvents()); 
            this.withHttpRequest(instance.getHttpRequest()); 
            this.withType(instance.getType()); 
    }

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

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

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

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

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

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

    public List getEvents(){
            return this.events;
    }

    public String getEvent(int index){
            return this.events.get(index);
    }

    public String getFirstEvent(){
            return this.events.get(0);
    }

    public String getLastEvent(){
            return this.events.get(events.size() - 1);
    }

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

    public A withEvents(List events){
            this.events.clear();
            if (events != null) {for (String item : events){this.addToEvents(item);}} return (A) this;
    }

    public A withEvents(String... events){
            this.events.clear(); if (events != null) {for (String item :events){ this.addToEvents(item);}} return (A) this;
    }

    public Boolean hasEvents(){
            return events!= null && !events.isEmpty();
    }

    
/**
 * This method has been deprecated, please use method buildHttpRequest instead.
 */
@Deprecated public PipelineHookHTTPRequest getHttpRequest(){
            return this.httpRequest!=null?this.httpRequest.build():null;
    }

    public PipelineHookHTTPRequest buildHttpRequest(){
            return this.httpRequest!=null?this.httpRequest.build():null;
    }

    public A withHttpRequest(PipelineHookHTTPRequest httpRequest){
            _visitables.remove(this.httpRequest);
            if (httpRequest!=null){ this.httpRequest= new PipelineHookHTTPRequestBuilder(httpRequest); _visitables.add(this.httpRequest);} return (A) this;
    }

    public Boolean hasHttpRequest(){
            return this.httpRequest!=null;
    }

    public PipelineHookFluent.HttpRequestNested withNewHttpRequest(){
            return new HttpRequestNestedImpl();
    }

    public PipelineHookFluent.HttpRequestNested withNewHttpRequestLike(PipelineHookHTTPRequest item){
            return new HttpRequestNestedImpl(item);
    }

    public PipelineHookFluent.HttpRequestNested editHttpRequest(){
            return withNewHttpRequestLike(getHttpRequest());
    }

    public PipelineHookFluent.HttpRequestNested editOrNewHttpRequest(){
            return withNewHttpRequestLike(getHttpRequest() != null ? getHttpRequest(): new PipelineHookHTTPRequestBuilder().build());
    }

    public PipelineHookFluent.HttpRequestNested editOrNewHttpRequestLike(PipelineHookHTTPRequest item){
            return withNewHttpRequestLike(getHttpRequest() != null ? getHttpRequest(): item);
    }

    public String getType(){
            return this.type;
    }

    public A withType(String type){
            this.type=type; return (A) this;
    }

    public Boolean hasType(){
            return this.type!=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;
            PipelineHookFluentImpl that = (PipelineHookFluentImpl) o;
            if (events != null ? !events.equals(that.events) :that.events != null) return false;
            if (httpRequest != null ? !httpRequest.equals(that.httpRequest) :that.httpRequest != null) return false;
            if (type != null ? !type.equals(that.type) :that.type != null) return false;
            return true;
    }


    public class HttpRequestNestedImpl extends PipelineHookHTTPRequestFluentImpl> implements PipelineHookFluent.HttpRequestNested,io.alauda.kubernetes.api.builder.Nested{

            private final PipelineHookHTTPRequestBuilder builder;
    
            HttpRequestNestedImpl(PipelineHookHTTPRequest item){
                    this.builder = new PipelineHookHTTPRequestBuilder(this, item);
            }
            HttpRequestNestedImpl(){
                    this.builder = new PipelineHookHTTPRequestBuilder(this);
            }
    
    public N and(){
            return (N) PipelineHookFluentImpl.this.withHttpRequest(builder.build());
    }
    public N endHttpRequest(){
            return and();
    }

}


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy