io.github.cdklabs.projen.TomlFile Maven / Gradle / Ivy
Show all versions of projen Show documentation
package io.github.cdklabs.projen;
/**
* (experimental) Represents a TOML file.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.105.0 (build 0a2adcb)", date = "2024-11-15T17:03:54.865Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = io.github.cdklabs.projen.$Module.class, fqn = "projen.TomlFile")
public class TomlFile extends io.github.cdklabs.projen.ObjectFile {
protected TomlFile(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected TomlFile(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param project This parameter is required.
* @param filePath This parameter is required.
* @param options This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public TomlFile(final @org.jetbrains.annotations.NotNull io.github.cdklabs.projen.Project project, final @org.jetbrains.annotations.NotNull java.lang.String filePath, final @org.jetbrains.annotations.NotNull io.github.cdklabs.projen.TomlFileOptions options) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(project, "project is required"), java.util.Objects.requireNonNull(filePath, "filePath is required"), java.util.Objects.requireNonNull(options, "options is required") });
}
/**
* (experimental) Implemented by derived classes and returns the contents of the file to emit.
*
* @param resolver This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
protected @org.jetbrains.annotations.Nullable java.lang.String synthesizeContent(final @org.jetbrains.annotations.NotNull io.github.cdklabs.projen.IResolver resolver) {
return software.amazon.jsii.Kernel.call(this, "synthesizeContent", software.amazon.jsii.NativeType.forClass(java.lang.String.class), new Object[] { java.util.Objects.requireNonNull(resolver, "resolver is required") });
}
/**
* (experimental) A fluent builder for {@link io.github.cdklabs.projen.TomlFile}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
* @param project This parameter is required.
* @param filePath This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static Builder create(final io.github.cdklabs.projen.Project project, final java.lang.String filePath) {
return new Builder(project, filePath);
}
private final io.github.cdklabs.projen.Project project;
private final java.lang.String filePath;
private final io.github.cdklabs.projen.TomlFileOptions.Builder options;
private Builder(final io.github.cdklabs.projen.Project project, final java.lang.String filePath) {
this.project = project;
this.filePath = filePath;
this.options = new io.github.cdklabs.projen.TomlFileOptions.Builder();
}
/**
* (experimental) Indicates whether this file should be committed to git or ignored.
*
* By
* default, all generated files are committed and anti-tamper is used to
* protect against manual modifications.
*
* Default: true
*
* @return {@code this}
* @param committed Indicates whether this file should be committed to git or ignored. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder committed(final java.lang.Boolean committed) {
this.options.committed(committed);
return this;
}
/**
* (experimental) Update the project's .gitignore file.
*
* Default: true
*
* @return {@code this}
* @param editGitignore Update the project's .gitignore file. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder editGitignore(final java.lang.Boolean editGitignore) {
this.options.editGitignore(editGitignore);
return this;
}
/**
* (experimental) Whether the generated file should be marked as executable.
*
* Default: false
*
* @return {@code this}
* @param executable Whether the generated file should be marked as executable. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder executable(final java.lang.Boolean executable) {
this.options.executable(executable);
return this;
}
/**
* (experimental) Adds the projen marker to the file.
*
* Default: - marker will be included as long as the project is not ejected
*
* @return {@code this}
* @param marker Adds the projen marker to the file. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder marker(final java.lang.Boolean marker) {
this.options.marker(marker);
return this;
}
/**
* (experimental) Whether the generated file should be readonly.
*
* Default: true
*
* @return {@code this}
* @param readonly Whether the generated file should be readonly. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder readonly(final java.lang.Boolean readonly) {
this.options.readonly(readonly);
return this;
}
/**
* (experimental) The object that will be serialized. You can modify the object's contents before synthesis.
*
* Serialization of the object is similar to JSON.stringify with few enhancements:
*
*
* - values that are functions will be called during synthesis and the result will be serialized - this allow to have lazy values.
* Set
will be converted to array
* Map
will be converted to a plain object ({ key: value, ... }})
* RegExp
without flags will be converted to string representation of the source
*
*
* Default: {} an empty object (use `file.obj` to mutate).
*
* @return {@code this}
* @param obj The object that will be serialized. You can modify the object's contents before synthesis. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder obj(final java.lang.Object obj) {
this.options.obj(obj);
return this;
}
/**
* (experimental) Omits empty objects and arrays.
*
* Default: false
*
* @return {@code this}
* @param omitEmpty Omits empty objects and arrays. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder omitEmpty(final java.lang.Boolean omitEmpty) {
this.options.omitEmpty(omitEmpty);
return this;
}
/**
* @return a newly built instance of {@link io.github.cdklabs.projen.TomlFile}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public io.github.cdklabs.projen.TomlFile build() {
return new io.github.cdklabs.projen.TomlFile(
this.project,
this.filePath,
this.options.build()
);
}
}
}