io.github.cdklabs.projen.javascript.YarnBerryOptions Maven / Gradle / Ivy
Show all versions of projen Show documentation
package io.github.cdklabs.projen.javascript;
/**
* (experimental) Configure Yarn Berry.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.105.0 (build 0a2adcb)", date = "2024-11-15T17:03:55.361Z")
@software.amazon.jsii.Jsii(module = io.github.cdklabs.projen.$Module.class, fqn = "projen.javascript.YarnBerryOptions")
@software.amazon.jsii.Jsii.Proxy(YarnBerryOptions.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface YarnBerryOptions extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) A fully specified version to use for yarn (e.g., x.x.x).
*
* Default: - 4.0.1
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getVersion() {
return null;
}
/**
* (experimental) The yarnrc configuration.
*
* Default: - a blank Yarn RC file
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable io.github.cdklabs.projen.javascript.YarnrcOptions getYarnRcOptions() {
return null;
}
/**
* (experimental) Should zero-installs be enabled?
*
* Learn more at: https://yarnpkg.com/features/caching#zero-installs
*
* Default: false
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Boolean getZeroInstalls() {
return null;
}
/**
* @return a {@link Builder} of {@link YarnBerryOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link YarnBerryOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.String version;
io.github.cdklabs.projen.javascript.YarnrcOptions yarnRcOptions;
java.lang.Boolean zeroInstalls;
/**
* Sets the value of {@link YarnBerryOptions#getVersion}
* @param version A fully specified version to use for yarn (e.g., x.x.x).
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder version(java.lang.String version) {
this.version = version;
return this;
}
/**
* Sets the value of {@link YarnBerryOptions#getYarnRcOptions}
* @param yarnRcOptions The yarnrc configuration.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder yarnRcOptions(io.github.cdklabs.projen.javascript.YarnrcOptions yarnRcOptions) {
this.yarnRcOptions = yarnRcOptions;
return this;
}
/**
* Sets the value of {@link YarnBerryOptions#getZeroInstalls}
* @param zeroInstalls Should zero-installs be enabled?.
* Learn more at: https://yarnpkg.com/features/caching#zero-installs
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder zeroInstalls(java.lang.Boolean zeroInstalls) {
this.zeroInstalls = zeroInstalls;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link YarnBerryOptions}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public YarnBerryOptions build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link YarnBerryOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements YarnBerryOptions {
private final java.lang.String version;
private final io.github.cdklabs.projen.javascript.YarnrcOptions yarnRcOptions;
private final java.lang.Boolean zeroInstalls;
/**
* 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.version = software.amazon.jsii.Kernel.get(this, "version", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.yarnRcOptions = software.amazon.jsii.Kernel.get(this, "yarnRcOptions", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.projen.javascript.YarnrcOptions.class));
this.zeroInstalls = software.amazon.jsii.Kernel.get(this, "zeroInstalls", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.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.version = builder.version;
this.yarnRcOptions = builder.yarnRcOptions;
this.zeroInstalls = builder.zeroInstalls;
}
@Override
public final java.lang.String getVersion() {
return this.version;
}
@Override
public final io.github.cdklabs.projen.javascript.YarnrcOptions getYarnRcOptions() {
return this.yarnRcOptions;
}
@Override
public final java.lang.Boolean getZeroInstalls() {
return this.zeroInstalls;
}
@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.getVersion() != null) {
data.set("version", om.valueToTree(this.getVersion()));
}
if (this.getYarnRcOptions() != null) {
data.set("yarnRcOptions", om.valueToTree(this.getYarnRcOptions()));
}
if (this.getZeroInstalls() != null) {
data.set("zeroInstalls", om.valueToTree(this.getZeroInstalls()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("projen.javascript.YarnBerryOptions"));
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;
YarnBerryOptions.Jsii$Proxy that = (YarnBerryOptions.Jsii$Proxy) o;
if (this.version != null ? !this.version.equals(that.version) : that.version != null) return false;
if (this.yarnRcOptions != null ? !this.yarnRcOptions.equals(that.yarnRcOptions) : that.yarnRcOptions != null) return false;
return this.zeroInstalls != null ? this.zeroInstalls.equals(that.zeroInstalls) : that.zeroInstalls == null;
}
@Override
public final int hashCode() {
int result = this.version != null ? this.version.hashCode() : 0;
result = 31 * result + (this.yarnRcOptions != null ? this.yarnRcOptions.hashCode() : 0);
result = 31 * result + (this.zeroInstalls != null ? this.zeroInstalls.hashCode() : 0);
return result;
}
}
}