org.cdk8s.NameOptions Maven / Gradle / Ivy
Show all versions of cdk8s Show documentation
package org.cdk8s;
/**
* Options for name generation.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.95.0 (build f1ff514)", date = "2024-03-07T12:12:06.020Z")
@software.amazon.jsii.Jsii(module = org.cdk8s.$Module.class, fqn = "cdk8s.NameOptions")
@software.amazon.jsii.Jsii.Proxy(NameOptions.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface NameOptions extends software.amazon.jsii.JsiiSerializable {
/**
* Delimiter to use between components.
*
* Default: "-"
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.String getDelimiter() {
return null;
}
/**
* Extra components to include in the name.
*
* Default: [] use the construct path components
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.util.List getExtra() {
return null;
}
/**
* Include a short hash as last part of the name.
*
* Default: true
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.Boolean getIncludeHash() {
return null;
}
/**
* Maximum allowed length for the name.
*
* Default: 63
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.Number getMaxLen() {
return null;
}
/**
* @return a {@link Builder} of {@link NameOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link NameOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.String delimiter;
java.util.List extra;
java.lang.Boolean includeHash;
java.lang.Number maxLen;
/**
* Sets the value of {@link NameOptions#getDelimiter}
* @param delimiter Delimiter to use between components.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder delimiter(java.lang.String delimiter) {
this.delimiter = delimiter;
return this;
}
/**
* Sets the value of {@link NameOptions#getExtra}
* @param extra Extra components to include in the name.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder extra(java.util.List extra) {
this.extra = extra;
return this;
}
/**
* Sets the value of {@link NameOptions#getIncludeHash}
* @param includeHash Include a short hash as last part of the name.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder includeHash(java.lang.Boolean includeHash) {
this.includeHash = includeHash;
return this;
}
/**
* Sets the value of {@link NameOptions#getMaxLen}
* @param maxLen Maximum allowed length for the name.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder maxLen(java.lang.Number maxLen) {
this.maxLen = maxLen;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link NameOptions}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public NameOptions build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link NameOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements NameOptions {
private final java.lang.String delimiter;
private final java.util.List extra;
private final java.lang.Boolean includeHash;
private final java.lang.Number maxLen;
/**
* Constructor that initializes the object based on values retrieved from the JsiiObject.
* @param objRef Reference to the JSII managed object.
*/
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
this.delimiter = software.amazon.jsii.Kernel.get(this, "delimiter", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.extra = software.amazon.jsii.Kernel.get(this, "extra", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class)));
this.includeHash = software.amazon.jsii.Kernel.get(this, "includeHash", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
this.maxLen = software.amazon.jsii.Kernel.get(this, "maxLen", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.delimiter = builder.delimiter;
this.extra = builder.extra;
this.includeHash = builder.includeHash;
this.maxLen = builder.maxLen;
}
@Override
public final java.lang.String getDelimiter() {
return this.delimiter;
}
@Override
public final java.util.List getExtra() {
return this.extra;
}
@Override
public final java.lang.Boolean getIncludeHash() {
return this.includeHash;
}
@Override
public final java.lang.Number getMaxLen() {
return this.maxLen;
}
@Override
@software.amazon.jsii.Internal
public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
if (this.getDelimiter() != null) {
data.set("delimiter", om.valueToTree(this.getDelimiter()));
}
if (this.getExtra() != null) {
data.set("extra", om.valueToTree(this.getExtra()));
}
if (this.getIncludeHash() != null) {
data.set("includeHash", om.valueToTree(this.getIncludeHash()));
}
if (this.getMaxLen() != null) {
data.set("maxLen", om.valueToTree(this.getMaxLen()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("cdk8s.NameOptions"));
struct.set("data", data);
final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
obj.set("$jsii.struct", struct);
return obj;
}
@Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
NameOptions.Jsii$Proxy that = (NameOptions.Jsii$Proxy) o;
if (this.delimiter != null ? !this.delimiter.equals(that.delimiter) : that.delimiter != null) return false;
if (this.extra != null ? !this.extra.equals(that.extra) : that.extra != null) return false;
if (this.includeHash != null ? !this.includeHash.equals(that.includeHash) : that.includeHash != null) return false;
return this.maxLen != null ? this.maxLen.equals(that.maxLen) : that.maxLen == null;
}
@Override
public final int hashCode() {
int result = this.delimiter != null ? this.delimiter.hashCode() : 0;
result = 31 * result + (this.extra != null ? this.extra.hashCode() : 0);
result = 31 * result + (this.includeHash != null ? this.includeHash.hashCode() : 0);
result = 31 * result + (this.maxLen != null ? this.maxLen.hashCode() : 0);
return result;
}
}
}