
io.sundr.model.AnnotationRefFluent Maven / Gradle / Ivy
package io.sundr.model;
import java.lang.SuppressWarnings;
import io.sundr.builder.Nested;
import java.lang.String;
import java.util.LinkedHashMap;
import java.lang.Object;
import java.util.Map;
/**
* Generated
*/
@SuppressWarnings("unchecked")
public class AnnotationRefFluent> extends AttributeSupportFluent{
public AnnotationRefFluent() {
}
public AnnotationRefFluent(AnnotationRef instance) {
this.copyInstance(instance);
}
private ClassRefBuilder classRef;
private Map parameters = new LinkedHashMap();
protected void copyInstance(AnnotationRef instance) {
if (instance != null) {
this.withClassRef(instance.getClassRef());
this.withParameters(instance.getParameters());
this.withAttributes(instance.getAttributes());
}
}
public ClassRef buildClassRef() {
return this.classRef!=null ?this.classRef.build():null;
}
public A withClassRef(ClassRef classRef) {
_visitables.get("classRef").remove(this.classRef);
if (classRef!=null){ this.classRef= new ClassRefBuilder(classRef); _visitables.get("classRef").add(this.classRef);} else { this.classRef = null; _visitables.get("classRef").remove(this.classRef); } return (A) this;
}
public boolean hasClassRef() {
return this.classRef != null;
}
public ClassRefNested withNewClassRef() {
return new ClassRefNested(null);
}
public ClassRefNested withNewClassRefLike(ClassRef item) {
return new ClassRefNested(item);
}
public ClassRefNested editClassRef() {
return withNewClassRefLike(java.util.Optional.ofNullable(buildClassRef()).orElse(null));
}
public ClassRefNested editOrNewClassRef() {
return withNewClassRefLike(java.util.Optional.ofNullable(buildClassRef()).orElse(new ClassRefBuilder().build()));
}
public ClassRefNested editOrNewClassRefLike(ClassRef item) {
return withNewClassRefLike(java.util.Optional.ofNullable(buildClassRef()).orElse(item));
}
public A addToParameters(String key,Object value) {
if(this.parameters == null && key != null && value != null) { this.parameters = new LinkedHashMap(); }
if(key != null && value != null) {this.parameters.put(key, value);} return (A)this;
}
public A addToParameters(Map map) {
if(this.parameters == null && map != null) { this.parameters = new LinkedHashMap(); }
if(map != null) { this.parameters.putAll(map);} return (A)this;
}
public A removeFromParameters(String key) {
if(this.parameters == null) { return (A) this; }
if(key != null && this.parameters != null) {this.parameters.remove(key);} return (A)this;
}
public A removeFromParameters(Map map) {
if(this.parameters == null) { return (A) this; }
if(map != null) { for(Object key : map.keySet()) {if (this.parameters != null){this.parameters.remove(key);}}} return (A)this;
}
public Map getParameters() {
return this.parameters;
}
public A withParameters(Map parameters) {
if (parameters == null) { this.parameters = null;} else {this.parameters = new LinkedHashMap(parameters);} return (A) this;
}
public boolean hasParameters() {
return this.parameters != 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;
AnnotationRefFluent that = (AnnotationRefFluent) o;
if (!java.util.Objects.equals(classRef, that.classRef)) return false;
if (!java.util.Objects.equals(parameters, that.parameters)) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(classRef, parameters, super.hashCode());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (classRef != null) { sb.append("classRef:"); sb.append(classRef + ","); }
if (parameters != null && !parameters.isEmpty()) { sb.append("parameters:"); sb.append(parameters); }
sb.append("}");
return sb.toString();
}
public class ClassRefNested extends ClassRefFluent> implements Nested{
ClassRefNested(ClassRef item) {
this.builder = new ClassRefBuilder(this, item);
}
ClassRefBuilder builder;
public N and() {
return (N) AnnotationRefFluent.this.withClassRef(builder.build());
}
public N endClassRef() {
return and();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy