org.projen.YamlFile Maven / Gradle / Ivy
Show all versions of projen Show documentation
package org.projen;
/**
* (experimental) Represents a YAML file.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.34.0 (build 9b72778)", date = "2021-09-05T18:03:09.265Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = org.projen.$Module.class, fqn = "projen.YamlFile")
public class YamlFile extends org.projen.ObjectFile {
protected YamlFile(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected YamlFile(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 YamlFile(final @org.jetbrains.annotations.NotNull org.projen.Project project, final @org.jetbrains.annotations.NotNull java.lang.String filePath, final @org.jetbrains.annotations.NotNull org.projen.YamlFileOptions 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 org.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 org.projen.YamlFile}.
*/
@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 org.projen.Project project, final java.lang.String filePath) {
return new Builder(project, filePath);
}
private final org.projen.Project project;
private final java.lang.String filePath;
private final org.projen.YamlFileOptions.Builder options;
private Builder(final org.projen.Project project, final java.lang.String filePath) {
this.project = project;
this.filePath = filePath;
this.options = new org.projen.YamlFileOptions.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) 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) Adds the projen marker to the file.
*
* Default: true
*
* @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) The object that will be serialized.
*
* You can modify the object's contents
* before synthesis.
*
* Default: {} an empty object (use `file.obj` to mutate).
*
* @return {@code this}
* @param obj The object that will be serialized. 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;
}
/**
* @returns a newly built instance of {@link org.projen.YamlFile}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public org.projen.YamlFile build() {
return new org.projen.YamlFile(
this.project,
this.filePath,
this.options.build()
);
}
}
}