io.github.cdklabs.projen.SampleDirOptions Maven / Gradle / Ivy
Show all versions of projen Show documentation
package io.github.cdklabs.projen;
/**
* (experimental) SampleDir options.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.105.0 (build 0a2adcb)", date = "2024-11-15T17:03:54.843Z")
@software.amazon.jsii.Jsii(module = io.github.cdklabs.projen.$Module.class, fqn = "projen.SampleDirOptions")
@software.amazon.jsii.Jsii.Proxy(SampleDirOptions.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface SampleDirOptions extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) The files to render into the directory.
*
* These files get added after
* any files from source
if that option is specified (replacing if names
* overlap).
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.Map getFiles() {
return null;
}
/**
* (experimental) Absolute path to a directory to copy files from (does not need to be text files).
*
* If your project is typescript-based and has configured testdir
to be a
* subdirectory of src
, sample files should outside of the src
directory
* otherwise they may not be copied. For example:
*
*
* new SampleDir(this, 'public', { source: path.join(__dirname, '..', 'sample-assets') });
*
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getSourceDir() {
return null;
}
/**
* @return a {@link Builder} of {@link SampleDirOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link SampleDirOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.util.Map files;
java.lang.String sourceDir;
/**
* Sets the value of {@link SampleDirOptions#getFiles}
* @param files The files to render into the directory.
* These files get added after
* any files from source
if that option is specified (replacing if names
* overlap).
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder files(java.util.Map files) {
this.files = files;
return this;
}
/**
* Sets the value of {@link SampleDirOptions#getSourceDir}
* @param sourceDir Absolute path to a directory to copy files from (does not need to be text files).
* If your project is typescript-based and has configured testdir
to be a
* subdirectory of src
, sample files should outside of the src
directory
* otherwise they may not be copied. For example:
*
*
* new SampleDir(this, 'public', { source: path.join(__dirname, '..', 'sample-assets') });
*
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder sourceDir(java.lang.String sourceDir) {
this.sourceDir = sourceDir;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link SampleDirOptions}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public SampleDirOptions build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link SampleDirOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements SampleDirOptions {
private final java.util.Map files;
private final java.lang.String sourceDir;
/**
* 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.files = software.amazon.jsii.Kernel.get(this, "files", software.amazon.jsii.NativeType.mapOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class)));
this.sourceDir = software.amazon.jsii.Kernel.get(this, "sourceDir", software.amazon.jsii.NativeType.forClass(java.lang.String.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.files = builder.files;
this.sourceDir = builder.sourceDir;
}
@Override
public final java.util.Map getFiles() {
return this.files;
}
@Override
public final java.lang.String getSourceDir() {
return this.sourceDir;
}
@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.getFiles() != null) {
data.set("files", om.valueToTree(this.getFiles()));
}
if (this.getSourceDir() != null) {
data.set("sourceDir", om.valueToTree(this.getSourceDir()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("projen.SampleDirOptions"));
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;
SampleDirOptions.Jsii$Proxy that = (SampleDirOptions.Jsii$Proxy) o;
if (this.files != null ? !this.files.equals(that.files) : that.files != null) return false;
return this.sourceDir != null ? this.sourceDir.equals(that.sourceDir) : that.sourceDir == null;
}
@Override
public final int hashCode() {
int result = this.files != null ? this.files.hashCode() : 0;
result = 31 * result + (this.sourceDir != null ? this.sourceDir.hashCode() : 0);
return result;
}
}
}