annotations.me.snowdrop.istio.api.model.v1.broker.ServicePlanFluentImpl Maven / Gradle / Ivy
package me.snowdrop.istio.api.model.v1.broker;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import me.snowdrop.istio.api.builder.Nested;
import java.lang.String;
import me.snowdrop.istio.api.builder.Predicate;
import java.lang.Deprecated;
import javax.validation.Valid;
import me.snowdrop.istio.api.builder.BaseFluent;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.Boolean;
public class ServicePlanFluentImpl> extends me.snowdrop.istio.api.builder.BaseFluent implements ServicePlanFluent{
private CatalogPlanBuilder plan;
private List services;
public ServicePlanFluentImpl(){
}
public ServicePlanFluentImpl(ServicePlan instance){
this.withPlan(instance.getPlan());
this.withServices(instance.getServices());
}
/**
* This method has been deprecated, please use method buildPlan instead.
*/
@Deprecated public CatalogPlan getPlan(){
return this.plan!=null?this.plan.build():null;
}
public CatalogPlan buildPlan(){
return this.plan!=null?this.plan.build():null;
}
public A withPlan(CatalogPlan plan){
_visitables.remove(this.plan);
if (plan!=null){ this.plan= new CatalogPlanBuilder(plan); _visitables.add(this.plan);} return (A) this;
}
public Boolean hasPlan(){
return this.plan != null;
}
public A withNewPlan(String description,String id,String name){
return (A)withPlan(new CatalogPlan(description, id, name));
}
public ServicePlanFluent.PlanNested withNewPlan(){
return new PlanNestedImpl();
}
public ServicePlanFluent.PlanNested withNewPlanLike(CatalogPlan item){
return new PlanNestedImpl(item);
}
public ServicePlanFluent.PlanNested editPlan(){
return withNewPlanLike(getPlan());
}
public ServicePlanFluent.PlanNested editOrNewPlan(){
return withNewPlanLike(getPlan() != null ? getPlan(): new CatalogPlanBuilder().build());
}
public ServicePlanFluent.PlanNested editOrNewPlanLike(CatalogPlan item){
return withNewPlanLike(getPlan() != null ? getPlan(): item);
}
public A addToServices(int index,String item){
if (this.services == null) {this.services = new ArrayList();}
this.services.add(index, item);
return (A)this;
}
public A setToServices(int index,String item){
this.services.set(index, item); return (A)this;
}
public A addToServices(String... items){
for (String item : items) {this.services.add(item);} return (A)this;
}
public A addAllToServices(Collection items){
for (String item : items) {this.services.add(item);} return (A)this;
}
public A removeFromServices(String... items){
for (String item : items) {if (this.services!= null){ this.services.remove(item);}} return (A)this;
}
public A removeAllFromServices(Collection items){
for (String item : items) {if (this.services!= null){ this.services.remove(item);}} return (A)this;
}
public List getServices(){
return this.services;
}
public String getService(int index){
return this.services.get(index);
}
public String getFirstService(){
return this.services.get(0);
}
public String getLastService(){
return this.services.get(services.size() - 1);
}
public String getMatchingService(me.snowdrop.istio.api.builder.Predicate predicate){
for (String item: services) { if(predicate.apply(item)){return item;} } return null;
}
public A withServices(List services){
if (this.services == null) { this.services = new ArrayList();} else {_visitables.removeAll(this.services); this.services.clear();}
if (services != null) {for (String item : services){this.addToServices(item);}} return (A) this;
}
public A withServices(String... services){
this.services.clear(); if (services != null) {for (String item :services){ this.addToServices(item);}} return (A) this;
}
public Boolean hasServices(){
return services != null && !services.isEmpty();
}
public boolean equals(Object o){
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
ServicePlanFluentImpl that = (ServicePlanFluentImpl) o;
if (plan != null ? !plan.equals(that.plan) :that.plan != null) return false;
if (services != null ? !services.equals(that.services) :that.services != null) return false;
return true;
}
public class PlanNestedImpl extends CatalogPlanFluentImpl> implements ServicePlanFluent.PlanNested,me.snowdrop.istio.api.builder.Nested{
private final CatalogPlanBuilder builder;
PlanNestedImpl(CatalogPlan item){
this.builder = new CatalogPlanBuilder(this, item);
}
PlanNestedImpl(){
this.builder = new CatalogPlanBuilder(this);
}
public N and(){
return (N) ServicePlanFluentImpl.this.withPlan(builder.build());
}
public N endPlan(){
return and();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy