me.snowdrop.istio.api.networking.v1alpha3.TLSRouteFluentImpl Maven / Gradle / Ivy
package me.snowdrop.istio.api.networking.v1alpha3;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import io.fabric8.kubernetes.api.builder.Predicate;
import java.lang.Deprecated;
import io.fabric8.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 TLSRouteFluentImpl> extends io.fabric8.kubernetes.api.builder.BaseFluent implements TLSRouteFluent{
private List match;
private List route;
public TLSRouteFluentImpl(){
}
public TLSRouteFluentImpl(TLSRoute instance){
this.withMatch(instance.getMatch());
this.withRoute(instance.getRoute());
}
public A addToMatch(int index,TLSMatchAttributes item){
if (this.match == null) {this.match = new ArrayList();}
TLSMatchAttributesBuilder builder = new TLSMatchAttributesBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.match.add(index >= 0 ? index : match.size(), builder); return (A)this;
}
public A setToMatch(int index,TLSMatchAttributes item){
if (this.match == null) {this.match = new ArrayList();}
TLSMatchAttributesBuilder builder = new TLSMatchAttributesBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= match.size()) { match.add(builder); } else { match.set(index, builder);}
return (A)this;
}
public A addToMatch(TLSMatchAttributes... items){
if (this.match == null) {this.match = new ArrayList();}
for (TLSMatchAttributes item : items) {TLSMatchAttributesBuilder builder = new TLSMatchAttributesBuilder(item);_visitables.add(builder);this.match.add(builder);} return (A)this;
}
public A addAllToMatch(Collection items){
if (this.match == null) {this.match = new ArrayList();}
for (TLSMatchAttributes item : items) {TLSMatchAttributesBuilder builder = new TLSMatchAttributesBuilder(item);_visitables.add(builder);this.match.add(builder);} return (A)this;
}
public A removeFromMatch(TLSMatchAttributes... items){
for (TLSMatchAttributes item : items) {TLSMatchAttributesBuilder builder = new TLSMatchAttributesBuilder(item);_visitables.remove(builder);if (this.match != null) {this.match.remove(builder);}} return (A)this;
}
public A removeAllFromMatch(Collection items){
for (TLSMatchAttributes item : items) {TLSMatchAttributesBuilder builder = new TLSMatchAttributesBuilder(item);_visitables.remove(builder);if (this.match != null) {this.match.remove(builder);}} return (A)this;
}
/**
* This method has been deprecated, please use method buildMatch instead.
* @return The buildable object.
*/
@Deprecated public List getMatch(){
return build(match);
}
public List buildMatch(){
return build(match);
}
public TLSMatchAttributes buildMatch(int index){
return this.match.get(index).build();
}
public TLSMatchAttributes buildFirstMatch(){
return this.match.get(0).build();
}
public TLSMatchAttributes buildLastMatch(){
return this.match.get(match.size() - 1).build();
}
public TLSMatchAttributes buildMatchingMatch(io.fabric8.kubernetes.api.builder.Predicate predicate){
for (TLSMatchAttributesBuilder item: match) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withMatch(List match){
if (this.match != null) { _visitables.removeAll(this.match);}
if (match != null) {this.match = new ArrayList(); for (TLSMatchAttributes item : match){this.addToMatch(item);}} else { this.match = null;} return (A) this;
}
public A withMatch(TLSMatchAttributes... match){
if (this.match != null) {this.match.clear();}
if (match != null) {for (TLSMatchAttributes item :match){ this.addToMatch(item);}} return (A) this;
}
public Boolean hasMatch(){
return match != null && !match.isEmpty();
}
public TLSRouteFluent.MatchNested addNewMatch(){
return new MatchNestedImpl();
}
public TLSRouteFluent.MatchNested addNewMatchLike(TLSMatchAttributes item){
return new MatchNestedImpl(-1, item);
}
public TLSRouteFluent.MatchNested setNewMatchLike(int index,TLSMatchAttributes item){
return new MatchNestedImpl(index, item);
}
public TLSRouteFluent.MatchNested editMatch(int index){
if (match.size() <= index) throw new RuntimeException("Can't edit match. Index exceeds size.");
return setNewMatchLike(index, buildMatch(index));
}
public TLSRouteFluent.MatchNested editFirstMatch(){
if (match.size() == 0) throw new RuntimeException("Can't edit first match. The list is empty.");
return setNewMatchLike(0, buildMatch(0));
}
public TLSRouteFluent.MatchNested editLastMatch(){
int index = match.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last match. The list is empty.");
return setNewMatchLike(index, buildMatch(index));
}
public TLSRouteFluent.MatchNested editMatchingMatch(io.fabric8.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i();}
RouteDestinationBuilder builder = new RouteDestinationBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.route.add(index >= 0 ? index : route.size(), builder); return (A)this;
}
public A setToRoute(int index,RouteDestination item){
if (this.route == null) {this.route = new ArrayList();}
RouteDestinationBuilder builder = new RouteDestinationBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= route.size()) { route.add(builder); } else { route.set(index, builder);}
return (A)this;
}
public A addToRoute(RouteDestination... items){
if (this.route == null) {this.route = new ArrayList();}
for (RouteDestination item : items) {RouteDestinationBuilder builder = new RouteDestinationBuilder(item);_visitables.add(builder);this.route.add(builder);} return (A)this;
}
public A addAllToRoute(Collection items){
if (this.route == null) {this.route = new ArrayList();}
for (RouteDestination item : items) {RouteDestinationBuilder builder = new RouteDestinationBuilder(item);_visitables.add(builder);this.route.add(builder);} return (A)this;
}
public A removeFromRoute(RouteDestination... items){
for (RouteDestination item : items) {RouteDestinationBuilder builder = new RouteDestinationBuilder(item);_visitables.remove(builder);if (this.route != null) {this.route.remove(builder);}} return (A)this;
}
public A removeAllFromRoute(Collection items){
for (RouteDestination item : items) {RouteDestinationBuilder builder = new RouteDestinationBuilder(item);_visitables.remove(builder);if (this.route != null) {this.route.remove(builder);}} return (A)this;
}
/**
* This method has been deprecated, please use method buildRoute instead.
* @return The buildable object.
*/
@Deprecated public List getRoute(){
return build(route);
}
public List buildRoute(){
return build(route);
}
public RouteDestination buildRoute(int index){
return this.route.get(index).build();
}
public RouteDestination buildFirstRoute(){
return this.route.get(0).build();
}
public RouteDestination buildLastRoute(){
return this.route.get(route.size() - 1).build();
}
public RouteDestination buildMatchingRoute(io.fabric8.kubernetes.api.builder.Predicate predicate){
for (RouteDestinationBuilder item: route) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withRoute(List route){
if (this.route != null) { _visitables.removeAll(this.route);}
if (route != null) {this.route = new ArrayList(); for (RouteDestination item : route){this.addToRoute(item);}} else { this.route = null;} return (A) this;
}
public A withRoute(RouteDestination... route){
if (this.route != null) {this.route.clear();}
if (route != null) {for (RouteDestination item :route){ this.addToRoute(item);}} return (A) this;
}
public Boolean hasRoute(){
return route != null && !route.isEmpty();
}
public TLSRouteFluent.RouteNested addNewRoute(){
return new RouteNestedImpl();
}
public TLSRouteFluent.RouteNested addNewRouteLike(RouteDestination item){
return new RouteNestedImpl(-1, item);
}
public TLSRouteFluent.RouteNested setNewRouteLike(int index,RouteDestination item){
return new RouteNestedImpl(index, item);
}
public TLSRouteFluent.RouteNested editRoute(int index){
if (route.size() <= index) throw new RuntimeException("Can't edit route. Index exceeds size.");
return setNewRouteLike(index, buildRoute(index));
}
public TLSRouteFluent.RouteNested editFirstRoute(){
if (route.size() == 0) throw new RuntimeException("Can't edit first route. The list is empty.");
return setNewRouteLike(0, buildRoute(0));
}
public TLSRouteFluent.RouteNested editLastRoute(){
int index = route.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last route. The list is empty.");
return setNewRouteLike(index, buildRoute(index));
}
public TLSRouteFluent.RouteNested editMatchingRoute(io.fabric8.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i extends TLSMatchAttributesFluentImpl> implements TLSRouteFluent.MatchNested,io.fabric8.kubernetes.api.builder.Nested{
private final TLSMatchAttributesBuilder builder;
private final int index;
MatchNestedImpl(int index,TLSMatchAttributes item){
this.index = index;
this.builder = new TLSMatchAttributesBuilder(this, item);
}
MatchNestedImpl(){
this.index = -1;
this.builder = new TLSMatchAttributesBuilder(this);
}
public N and(){
return (N) TLSRouteFluentImpl.this.setToMatch(index, builder.build());
}
public N endMatch(){
return and();
}
}
public class RouteNestedImpl extends RouteDestinationFluentImpl> implements TLSRouteFluent.RouteNested,io.fabric8.kubernetes.api.builder.Nested{
private final RouteDestinationBuilder builder;
private final int index;
RouteNestedImpl(int index,RouteDestination item){
this.index = index;
this.builder = new RouteDestinationBuilder(this, item);
}
RouteNestedImpl(){
this.index = -1;
this.builder = new RouteDestinationBuilder(this);
}
public N and(){
return (N) TLSRouteFluentImpl.this.setToRoute(index, builder.build());
}
public N endRoute(){
return and();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy