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

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

There is a newer version: 22.0.0
Show newest version
package io.kubernetes.client.openapi.models;

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

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) {
        if (this.hostnames == null) {this.hostnames = new ArrayList();}
        this.hostnames.set(index, item); return (A)this;
    }

    public A addToHostnames(String... items) {
        if (this.hostnames == null) {this.hostnames = new ArrayList();}
        for (String item : items) {this.hostnames.add(item);} return (A)this;
    }

    public A addAllToHostnames(Collection items) {
        if (this.hostnames == null) {this.hostnames = new ArrayList();}
        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 Boolean hasMatchingHostname(io.kubernetes.client.fluent.Predicate predicate) {
        for (String item: hostnames) { if(predicate.apply(item)){ return true;} } return false;
    }

    public A withHostnames(List hostnames) {
        if (this.hostnames != null) { _visitables.get("hostnames").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) {
        if (this.hostnames != null) {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 A addNewHostname(String arg1) {
        return (A)addToHostnames(new String(arg1));
    }

    public A addNewHostname(StringBuilder arg1) {
        return (A)addToHostnames(new String(arg1));
    }

    public A addNewHostname(StringBuffer arg1) {
        return (A)addToHostnames(new String(arg1));
    }

    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 A withNewIp(String arg1) {
        return (A)withIp(new String(arg1));
    }

    public A withNewIp(StringBuilder arg1) {
        return (A)withIp(new String(arg1));
    }

    public A withNewIp(StringBuffer arg1) {
        return (A)withIp(new String(arg1));
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) 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;
    }

    public int hashCode() {
        return java.util.Objects.hash(hostnames,  ip,  super.hashCode());
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy