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

annotations.io.alauda.kubernetes.api.model.EndpointSubsetFluentImpl 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 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.lang.Deprecated;
import io.alauda.kubernetes.api.builder.BaseFluent;
import java.util.List;
import java.lang.Boolean;
import java.lang.Integer;
import javax.validation.Valid;
import java.util.Collection;
import java.lang.Object;

public class EndpointSubsetFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements EndpointSubsetFluent{

    private List addresses =  new ArrayList();
    private List notReadyAddresses =  new ArrayList();
    private List ports =  new ArrayList();

    public EndpointSubsetFluentImpl(){
    }
    public EndpointSubsetFluentImpl(EndpointSubset instance){
            this.withAddresses(instance.getAddresses()); 
            this.withNotReadyAddresses(instance.getNotReadyAddresses()); 
            this.withPorts(instance.getPorts()); 
    }

    public A addToAddresses(int index,EndpointAddress item){
            EndpointAddressBuilder builder = new EndpointAddressBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.addresses.add(index >= 0 ? index : addresses.size(), builder); return (A)this;
    }

    public A setToAddresses(int index,EndpointAddress item){
            EndpointAddressBuilder builder = new EndpointAddressBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= addresses.size()) { addresses.add(builder); } else { addresses.set(index, builder);}
             return (A)this;
    }

    public A addToAddresses(EndpointAddress... items){
            for (EndpointAddress item : items) {EndpointAddressBuilder builder = new EndpointAddressBuilder(item);_visitables.add(builder);this.addresses.add(builder);} return (A)this;
    }

    public A addAllToAddresses(Collection items){
            for (EndpointAddress item : items) {EndpointAddressBuilder builder = new EndpointAddressBuilder(item);_visitables.add(builder);this.addresses.add(builder);} return (A)this;
    }

    public A removeFromAddresses(EndpointAddress... items){
            for (EndpointAddress item : items) {EndpointAddressBuilder builder = new EndpointAddressBuilder(item);_visitables.remove(builder);this.addresses.remove(builder);} return (A)this;
    }

    public A removeAllFromAddresses(Collection items){
            for (EndpointAddress item : items) {EndpointAddressBuilder builder = new EndpointAddressBuilder(item);_visitables.remove(builder);this.addresses.remove(builder);} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildAddresses instead.
 */
@Deprecated public List getAddresses(){
            return build(addresses);
    }

    public List buildAddresses(){
            return build(addresses);
    }

    public EndpointAddress buildAddress(int index){
            return this.addresses.get(index).build();
    }

    public EndpointAddress buildFirstAddress(){
            return this.addresses.get(0).build();
    }

    public EndpointAddress buildLastAddress(){
            return this.addresses.get(addresses.size() - 1).build();
    }

    public EndpointAddress buildMatchingAddress(io.alauda.kubernetes.api.builder.Predicate predicate){
            for (EndpointAddressBuilder item: addresses) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withAddresses(List addresses){
            _visitables.removeAll(this.addresses);
            this.addresses.clear();
            if (addresses != null) {for (EndpointAddress item : addresses){this.addToAddresses(item);}} return (A) this;
    }

    public A withAddresses(EndpointAddress... addresses){
            this.addresses.clear(); if (addresses != null) {for (EndpointAddress item :addresses){ this.addToAddresses(item);}} return (A) this;
    }

    public Boolean hasAddresses(){
            return addresses!= null && !addresses.isEmpty();
    }

    public EndpointSubsetFluent.AddressesNested addNewAddress(){
            return new AddressesNestedImpl();
    }

    public EndpointSubsetFluent.AddressesNested addNewAddressLike(EndpointAddress item){
            return new AddressesNestedImpl(-1, item);
    }

    public EndpointSubsetFluent.AddressesNested setNewAddressLike(int index,EndpointAddress item){
            return new AddressesNestedImpl(index, item);
    }

    public EndpointSubsetFluent.AddressesNested editAddress(int index){
            if (addresses.size() <= index) throw new RuntimeException("Can't edit addresses. Index exceeds size.");
            return setNewAddressLike(index, buildAddress(index));
    }

    public EndpointSubsetFluent.AddressesNested editFirstAddress(){
            if (addresses.size() == 0) throw new RuntimeException("Can't edit first addresses. The list is empty.");
            return setNewAddressLike(0, buildAddress(0));
    }

    public EndpointSubsetFluent.AddressesNested editLastAddress(){
            int index = addresses.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last addresses. The list is empty.");
            return setNewAddressLike(index, buildAddress(index));
    }

    public EndpointSubsetFluent.AddressesNested editMatchingAddress(io.alauda.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i= 0 ? index : _visitables.size(), builder);this.notReadyAddresses.add(index >= 0 ? index : notReadyAddresses.size(), builder); return (A)this;
    }

    public A setToNotReadyAddresses(int index,EndpointAddress item){
            EndpointAddressBuilder builder = new EndpointAddressBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= notReadyAddresses.size()) { notReadyAddresses.add(builder); } else { notReadyAddresses.set(index, builder);}
             return (A)this;
    }

    public A addToNotReadyAddresses(EndpointAddress... items){
            for (EndpointAddress item : items) {EndpointAddressBuilder builder = new EndpointAddressBuilder(item);_visitables.add(builder);this.notReadyAddresses.add(builder);} return (A)this;
    }

    public A addAllToNotReadyAddresses(Collection items){
            for (EndpointAddress item : items) {EndpointAddressBuilder builder = new EndpointAddressBuilder(item);_visitables.add(builder);this.notReadyAddresses.add(builder);} return (A)this;
    }

    public A removeFromNotReadyAddresses(EndpointAddress... items){
            for (EndpointAddress item : items) {EndpointAddressBuilder builder = new EndpointAddressBuilder(item);_visitables.remove(builder);this.notReadyAddresses.remove(builder);} return (A)this;
    }

    public A removeAllFromNotReadyAddresses(Collection items){
            for (EndpointAddress item : items) {EndpointAddressBuilder builder = new EndpointAddressBuilder(item);_visitables.remove(builder);this.notReadyAddresses.remove(builder);} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildNotReadyAddresses instead.
 */
@Deprecated public List getNotReadyAddresses(){
            return build(notReadyAddresses);
    }

    public List buildNotReadyAddresses(){
            return build(notReadyAddresses);
    }

    public EndpointAddress buildNotReadyAddress(int index){
            return this.notReadyAddresses.get(index).build();
    }

    public EndpointAddress buildFirstNotReadyAddress(){
            return this.notReadyAddresses.get(0).build();
    }

    public EndpointAddress buildLastNotReadyAddress(){
            return this.notReadyAddresses.get(notReadyAddresses.size() - 1).build();
    }

    public EndpointAddress buildMatchingNotReadyAddress(io.alauda.kubernetes.api.builder.Predicate predicate){
            for (EndpointAddressBuilder item: notReadyAddresses) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withNotReadyAddresses(List notReadyAddresses){
            _visitables.removeAll(this.notReadyAddresses);
            this.notReadyAddresses.clear();
            if (notReadyAddresses != null) {for (EndpointAddress item : notReadyAddresses){this.addToNotReadyAddresses(item);}} return (A) this;
    }

    public A withNotReadyAddresses(EndpointAddress... notReadyAddresses){
            this.notReadyAddresses.clear(); if (notReadyAddresses != null) {for (EndpointAddress item :notReadyAddresses){ this.addToNotReadyAddresses(item);}} return (A) this;
    }

    public Boolean hasNotReadyAddresses(){
            return notReadyAddresses!= null && !notReadyAddresses.isEmpty();
    }

    public EndpointSubsetFluent.NotReadyAddressesNested addNewNotReadyAddress(){
            return new NotReadyAddressesNestedImpl();
    }

    public EndpointSubsetFluent.NotReadyAddressesNested addNewNotReadyAddressLike(EndpointAddress item){
            return new NotReadyAddressesNestedImpl(-1, item);
    }

    public EndpointSubsetFluent.NotReadyAddressesNested setNewNotReadyAddressLike(int index,EndpointAddress item){
            return new NotReadyAddressesNestedImpl(index, item);
    }

    public EndpointSubsetFluent.NotReadyAddressesNested editNotReadyAddress(int index){
            if (notReadyAddresses.size() <= index) throw new RuntimeException("Can't edit notReadyAddresses. Index exceeds size.");
            return setNewNotReadyAddressLike(index, buildNotReadyAddress(index));
    }

    public EndpointSubsetFluent.NotReadyAddressesNested editFirstNotReadyAddress(){
            if (notReadyAddresses.size() == 0) throw new RuntimeException("Can't edit first notReadyAddresses. The list is empty.");
            return setNewNotReadyAddressLike(0, buildNotReadyAddress(0));
    }

    public EndpointSubsetFluent.NotReadyAddressesNested editLastNotReadyAddress(){
            int index = notReadyAddresses.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last notReadyAddresses. The list is empty.");
            return setNewNotReadyAddressLike(index, buildNotReadyAddress(index));
    }

    public EndpointSubsetFluent.NotReadyAddressesNested editMatchingNotReadyAddress(io.alauda.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i= 0 ? index : _visitables.size(), builder);this.ports.add(index >= 0 ? index : ports.size(), builder); return (A)this;
    }

    public A setToPorts(int index,EndpointPort item){
            EndpointPortBuilder builder = new EndpointPortBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= ports.size()) { ports.add(builder); } else { ports.set(index, builder);}
             return (A)this;
    }

    public A addToPorts(EndpointPort... items){
            for (EndpointPort item : items) {EndpointPortBuilder builder = new EndpointPortBuilder(item);_visitables.add(builder);this.ports.add(builder);} return (A)this;
    }

    public A addAllToPorts(Collection items){
            for (EndpointPort item : items) {EndpointPortBuilder builder = new EndpointPortBuilder(item);_visitables.add(builder);this.ports.add(builder);} return (A)this;
    }

    public A removeFromPorts(EndpointPort... items){
            for (EndpointPort item : items) {EndpointPortBuilder builder = new EndpointPortBuilder(item);_visitables.remove(builder);this.ports.remove(builder);} return (A)this;
    }

    public A removeAllFromPorts(Collection items){
            for (EndpointPort item : items) {EndpointPortBuilder builder = new EndpointPortBuilder(item);_visitables.remove(builder);this.ports.remove(builder);} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildPorts instead.
 */
@Deprecated public List getPorts(){
            return build(ports);
    }

    public List buildPorts(){
            return build(ports);
    }

    public EndpointPort buildPort(int index){
            return this.ports.get(index).build();
    }

    public EndpointPort buildFirstPort(){
            return this.ports.get(0).build();
    }

    public EndpointPort buildLastPort(){
            return this.ports.get(ports.size() - 1).build();
    }

    public EndpointPort buildMatchingPort(io.alauda.kubernetes.api.builder.Predicate predicate){
            for (EndpointPortBuilder item: ports) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withPorts(List ports){
            _visitables.removeAll(this.ports);
            this.ports.clear();
            if (ports != null) {for (EndpointPort item : ports){this.addToPorts(item);}} return (A) this;
    }

    public A withPorts(EndpointPort... ports){
            this.ports.clear(); if (ports != null) {for (EndpointPort item :ports){ this.addToPorts(item);}} return (A) this;
    }

    public Boolean hasPorts(){
            return ports!= null && !ports.isEmpty();
    }

    public EndpointSubsetFluent.PortsNested addNewPort(){
            return new PortsNestedImpl();
    }

    public EndpointSubsetFluent.PortsNested addNewPortLike(EndpointPort item){
            return new PortsNestedImpl(-1, item);
    }

    public EndpointSubsetFluent.PortsNested setNewPortLike(int index,EndpointPort item){
            return new PortsNestedImpl(index, item);
    }

    public EndpointSubsetFluent.PortsNested editPort(int index){
            if (ports.size() <= index) throw new RuntimeException("Can't edit ports. Index exceeds size.");
            return setNewPortLike(index, buildPort(index));
    }

    public EndpointSubsetFluent.PortsNested editFirstPort(){
            if (ports.size() == 0) throw new RuntimeException("Can't edit first ports. The list is empty.");
            return setNewPortLike(0, buildPort(0));
    }

    public EndpointSubsetFluent.PortsNested editLastPort(){
            int index = ports.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last ports. The list is empty.");
            return setNewPortLike(index, buildPort(index));
    }

    public EndpointSubsetFluent.PortsNested editMatchingPort(io.alauda.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i extends EndpointAddressFluentImpl> implements EndpointSubsetFluent.AddressesNested,io.alauda.kubernetes.api.builder.Nested{

            private final EndpointAddressBuilder builder;
        private final int index;
    
            AddressesNestedImpl(int index,EndpointAddress item){
                    this.index = index;
                    this.builder = new EndpointAddressBuilder(this, item);
            }
            AddressesNestedImpl(){
                    this.index = -1;
                    this.builder = new EndpointAddressBuilder(this);
            }
    
    public N and(){
            return (N) EndpointSubsetFluentImpl.this.setToAddresses(index, builder.build());
    }
    public N endAddress(){
            return and();
    }

}
    public class NotReadyAddressesNestedImpl extends EndpointAddressFluentImpl> implements EndpointSubsetFluent.NotReadyAddressesNested,io.alauda.kubernetes.api.builder.Nested{

            private final EndpointAddressBuilder builder;
        private final int index;
    
            NotReadyAddressesNestedImpl(int index,EndpointAddress item){
                    this.index = index;
                    this.builder = new EndpointAddressBuilder(this, item);
            }
            NotReadyAddressesNestedImpl(){
                    this.index = -1;
                    this.builder = new EndpointAddressBuilder(this);
            }
    
    public N and(){
            return (N) EndpointSubsetFluentImpl.this.setToNotReadyAddresses(index, builder.build());
    }
    public N endNotReadyAddress(){
            return and();
    }

}
    public class PortsNestedImpl extends EndpointPortFluentImpl> implements EndpointSubsetFluent.PortsNested,io.alauda.kubernetes.api.builder.Nested{

            private final EndpointPortBuilder builder;
        private final int index;
    
            PortsNestedImpl(int index,EndpointPort item){
                    this.index = index;
                    this.builder = new EndpointPortBuilder(this, item);
            }
            PortsNestedImpl(){
                    this.index = -1;
                    this.builder = new EndpointPortBuilder(this);
            }
    
    public N and(){
            return (N) EndpointSubsetFluentImpl.this.setToPorts(index, builder.build());
    }
    public N endPort(){
            return and();
    }

}


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy