io.alauda.kubernetes.api.model.PersistentVolumeClaimSpecFluentImpl Maven / Gradle / Ivy
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 javax.validation.Valid;
import java.util.Collection;
import java.lang.Object;
public class PersistentVolumeClaimSpecFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements PersistentVolumeClaimSpecFluent{
private List accessModes = new ArrayList();
private ResourceRequirementsBuilder resources;
private LabelSelectorBuilder selector;
private String storageClassName;
private String volumeName;
public PersistentVolumeClaimSpecFluentImpl(){
}
public PersistentVolumeClaimSpecFluentImpl(PersistentVolumeClaimSpec instance){
this.withAccessModes(instance.getAccessModes());
this.withResources(instance.getResources());
this.withSelector(instance.getSelector());
this.withStorageClassName(instance.getStorageClassName());
this.withVolumeName(instance.getVolumeName());
}
public A addToAccessModes(int index,String item){
this.accessModes.add(index, item); return (A)this;
}
public A setToAccessModes(int index,String item){
this.accessModes.set(index, item); return (A)this;
}
public A addToAccessModes(String... items){
for (String item : items) {this.accessModes.add(item);} return (A)this;
}
public A addAllToAccessModes(Collection items){
for (String item : items) {this.accessModes.add(item);} return (A)this;
}
public A removeFromAccessModes(String... items){
for (String item : items) {this.accessModes.remove(item);} return (A)this;
}
public A removeAllFromAccessModes(Collection items){
for (String item : items) {this.accessModes.remove(item);} return (A)this;
}
public List getAccessModes(){
return this.accessModes;
}
public String getAccessMode(int index){
return this.accessModes.get(index);
}
public String getFirstAccessMode(){
return this.accessModes.get(0);
}
public String getLastAccessMode(){
return this.accessModes.get(accessModes.size() - 1);
}
public String getMatchingAccessMode(io.alauda.kubernetes.api.builder.Predicate predicate){
for (String item: accessModes) { if(predicate.apply(item)){return item;} } return null;
}
public A withAccessModes(List accessModes){
this.accessModes.clear();
if (accessModes != null) {for (String item : accessModes){this.addToAccessModes(item);}} return (A) this;
}
public A withAccessModes(String... accessModes){
this.accessModes.clear(); if (accessModes != null) {for (String item :accessModes){ this.addToAccessModes(item);}} return (A) this;
}
public Boolean hasAccessModes(){
return accessModes!= null && !accessModes.isEmpty();
}
/**
* This method has been deprecated, please use method buildResources instead.
*/
@Deprecated public ResourceRequirements getResources(){
return this.resources!=null?this.resources.build():null;
}
public ResourceRequirements buildResources(){
return this.resources!=null?this.resources.build():null;
}
public A withResources(ResourceRequirements resources){
_visitables.remove(this.resources);
if (resources!=null){ this.resources= new ResourceRequirementsBuilder(resources); _visitables.add(this.resources);} return (A) this;
}
public Boolean hasResources(){
return this.resources!=null;
}
public PersistentVolumeClaimSpecFluent.ResourcesNested withNewResources(){
return new ResourcesNestedImpl();
}
public PersistentVolumeClaimSpecFluent.ResourcesNested withNewResourcesLike(ResourceRequirements item){
return new ResourcesNestedImpl(item);
}
public PersistentVolumeClaimSpecFluent.ResourcesNested editResources(){
return withNewResourcesLike(getResources());
}
public PersistentVolumeClaimSpecFluent.ResourcesNested editOrNewResources(){
return withNewResourcesLike(getResources() != null ? getResources(): new ResourceRequirementsBuilder().build());
}
public PersistentVolumeClaimSpecFluent.ResourcesNested editOrNewResourcesLike(ResourceRequirements item){
return withNewResourcesLike(getResources() != null ? getResources(): item);
}
/**
* This method has been deprecated, please use method buildSelector instead.
*/
@Deprecated public LabelSelector getSelector(){
return this.selector!=null?this.selector.build():null;
}
public LabelSelector buildSelector(){
return this.selector!=null?this.selector.build():null;
}
public A withSelector(LabelSelector selector){
_visitables.remove(this.selector);
if (selector!=null){ this.selector= new LabelSelectorBuilder(selector); _visitables.add(this.selector);} return (A) this;
}
public Boolean hasSelector(){
return this.selector!=null;
}
public PersistentVolumeClaimSpecFluent.SelectorNested withNewSelector(){
return new SelectorNestedImpl();
}
public PersistentVolumeClaimSpecFluent.SelectorNested withNewSelectorLike(LabelSelector item){
return new SelectorNestedImpl(item);
}
public PersistentVolumeClaimSpecFluent.SelectorNested editSelector(){
return withNewSelectorLike(getSelector());
}
public PersistentVolumeClaimSpecFluent.SelectorNested editOrNewSelector(){
return withNewSelectorLike(getSelector() != null ? getSelector(): new LabelSelectorBuilder().build());
}
public PersistentVolumeClaimSpecFluent.SelectorNested editOrNewSelectorLike(LabelSelector item){
return withNewSelectorLike(getSelector() != null ? getSelector(): item);
}
public String getStorageClassName(){
return this.storageClassName;
}
public A withStorageClassName(String storageClassName){
this.storageClassName=storageClassName; return (A) this;
}
public Boolean hasStorageClassName(){
return this.storageClassName!=null;
}
public String getVolumeName(){
return this.volumeName;
}
public A withVolumeName(String volumeName){
this.volumeName=volumeName; return (A) this;
}
public Boolean hasVolumeName(){
return this.volumeName!=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;
PersistentVolumeClaimSpecFluentImpl that = (PersistentVolumeClaimSpecFluentImpl) o;
if (accessModes != null ? !accessModes.equals(that.accessModes) :that.accessModes != null) return false;
if (resources != null ? !resources.equals(that.resources) :that.resources != null) return false;
if (selector != null ? !selector.equals(that.selector) :that.selector != null) return false;
if (storageClassName != null ? !storageClassName.equals(that.storageClassName) :that.storageClassName != null) return false;
if (volumeName != null ? !volumeName.equals(that.volumeName) :that.volumeName != null) return false;
return true;
}
public class ResourcesNestedImpl extends ResourceRequirementsFluentImpl> implements PersistentVolumeClaimSpecFluent.ResourcesNested,io.alauda.kubernetes.api.builder.Nested{
private final ResourceRequirementsBuilder builder;
ResourcesNestedImpl(ResourceRequirements item){
this.builder = new ResourceRequirementsBuilder(this, item);
}
ResourcesNestedImpl(){
this.builder = new ResourceRequirementsBuilder(this);
}
public N and(){
return (N) PersistentVolumeClaimSpecFluentImpl.this.withResources(builder.build());
}
public N endResources(){
return and();
}
}
public class SelectorNestedImpl extends LabelSelectorFluentImpl> implements PersistentVolumeClaimSpecFluent.SelectorNested,io.alauda.kubernetes.api.builder.Nested{
private final LabelSelectorBuilder builder;
SelectorNestedImpl(LabelSelector item){
this.builder = new LabelSelectorBuilder(this, item);
}
SelectorNestedImpl(){
this.builder = new LabelSelectorBuilder(this);
}
public N and(){
return (N) PersistentVolumeClaimSpecFluentImpl.this.withSelector(builder.build());
}
public N endSelector(){
return and();
}
}
}