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

io.kubernetes.client.models.V1HostAliasFluentImpl Maven / Gradle / Ivy

package io.kubernetes.client.models;

import com.google.gson.annotations.SerializedName;
import io.kubernetes.client.fluent.BaseFluent;
import java.util.ArrayList;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.String;
import java.lang.Boolean;
import io.kubernetes.client.fluent.Predicate;

public class V1HostAliasFluentImpl> extends io.kubernetes.client.fluent.BaseFluent implements V1HostAliasFluent{

    private List hostnames;
    private String ip;

    public V1HostAliasFluentImpl(){
    }
    public V1HostAliasFluentImpl(V1HostAlias instance){
            this.withHostnames(instance.getHostnames());

            this.withIp(instance.getIp());

    }

    public A addToHostnames(int index,String item){
            if (this.hostnames == null) {this.hostnames = new ArrayList();}
            this.hostnames.add(index, item);
            return (A)this;
    }

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

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

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

    public A removeFromHostnames(String... items){
            for (String item : items) {if (this.hostnames!= null){ this.hostnames.remove(item);}} return (A)this;
    }

    public A removeAllFromHostnames(Collection items){
            for (String item : items) {if (this.hostnames!= null){ this.hostnames.remove(item);}} return (A)this;
    }

    public List getHostnames(){
            return this.hostnames;
    }

    public String getHostname(int index){
            return this.hostnames.get(index);
    }

    public String getFirstHostname(){
            return this.hostnames.get(0);
    }

    public String getLastHostname(){
            return this.hostnames.get(hostnames.size() - 1);
    }

    public String getMatchingHostname(io.kubernetes.client.fluent.Predicate predicate){
            for (String item: hostnames) { if(predicate.apply(item)){return item;} } return null;
    }

    public A withHostnames(List hostnames){
            if (this.hostnames != null) { _visitables.removeAll(this.hostnames);}
            if (hostnames != null) {this.hostnames = new ArrayList(); for (String item : hostnames){this.addToHostnames(item);}} else { this.hostnames = null;} return (A) this;
    }

    public A withHostnames(String... hostnames){
            this.hostnames.clear(); if (hostnames != null) {for (String item :hostnames){ this.addToHostnames(item);}} return (A) this;
    }

    public Boolean hasHostnames(){
            return hostnames != null && !hostnames.isEmpty();
    }

    public String getIp(){
            return this.ip;
    }

    public A withIp(String ip){
            this.ip=ip; return (A) this;
    }

    public Boolean hasIp(){
            return this.ip != 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;
            V1HostAliasFluentImpl that = (V1HostAliasFluentImpl) o;
            if (hostnames != null ? !hostnames.equals(that.hostnames) :that.hostnames != null) return false;
            if (ip != null ? !ip.equals(that.ip) :that.ip != null) return false;
            return true;
    }




}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy