Package io.github.cdklabs.projen
Class JsonFile.Builder
- java.lang.Object
-
- io.github.cdklabs.projen.JsonFile.Builder
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonFile.BuilderallowComments(Boolean allowComments)(experimental) Allow the use of comments in this file.JsonFilebuild()JsonFile.Buildercommitted(Boolean committed)(experimental) Indicates whether this file should be committed to git or ignored.static JsonFile.Buildercreate(software.constructs.IConstruct scope, String filePath)JsonFile.BuildereditGitignore(Boolean editGitignore)(experimental) Update the project's .gitignore file.JsonFile.Builderexecutable(Boolean executable)(experimental) Whether the generated file should be marked as executable.JsonFile.Buildermarker(Boolean marker)(experimental) Adds the projen marker to the file.JsonFile.Buildernewline(Boolean newline)(experimental) Adds a newline at the end of the file.JsonFile.Builderobj(Object obj)(experimental) The object that will be serialized.JsonFile.BuilderomitEmpty(Boolean omitEmpty)(experimental) Omits empty objects and arrays.JsonFile.Builderreadonly(Boolean readonly)(experimental) Whether the generated file should be readonly.
-
-
-
Method Detail
-
create
@Stability(Experimental) public static JsonFile.Builder create(software.constructs.IConstruct scope, String filePath)
- Parameters:
scope- This parameter is required.filePath- This parameter is required.- Returns:
- a new instance of
JsonFile.Builder.
-
committed
@Stability(Experimental) public JsonFile.Builder committed(Boolean committed)
(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
- Parameters:
committed- Indicates whether this file should be committed to git or ignored. This parameter is required.- Returns:
this
-
editGitignore
@Stability(Experimental) public JsonFile.Builder editGitignore(Boolean editGitignore)
(experimental) Update the project's .gitignore file.Default: true
- Parameters:
editGitignore- Update the project's .gitignore file. This parameter is required.- Returns:
this
-
executable
@Stability(Experimental) public JsonFile.Builder executable(Boolean executable)
(experimental) Whether the generated file should be marked as executable.Default: false
- Parameters:
executable- Whether the generated file should be marked as executable. This parameter is required.- Returns:
this
-
marker
@Stability(Experimental) public JsonFile.Builder marker(Boolean marker)
(experimental) Adds the projen marker to the file.Default: - marker will be included as long as the project is not ejected
- Parameters:
marker- Adds the projen marker to the file. This parameter is required.- Returns:
this
-
readonly
@Stability(Experimental) public JsonFile.Builder readonly(Boolean readonly)
(experimental) Whether the generated file should be readonly.Default: true
- Parameters:
readonly- Whether the generated file should be readonly. This parameter is required.- Returns:
this
-
obj
@Stability(Experimental) public JsonFile.Builder obj(Object obj)
(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.
Setwill be converted to arrayMapwill be converted to a plain object ({ key: value, ... }})RegExpwithout flags will be converted to string representation of the source
Default: {} an empty object (use `file.obj` to mutate).
- Parameters:
obj- The object that will be serialized. You can modify the object's contents before synthesis. This parameter is required.- Returns:
this
-
omitEmpty
@Stability(Experimental) public JsonFile.Builder omitEmpty(Boolean omitEmpty)
(experimental) Omits empty objects and arrays.Default: false
- Parameters:
omitEmpty- Omits empty objects and arrays. This parameter is required.- Returns:
this
-
allowComments
@Stability(Experimental) public JsonFile.Builder allowComments(Boolean allowComments)
(experimental) Allow the use of comments in this file.Default: - false for .json files, true for .json5 and .jsonc files
- Parameters:
allowComments- Allow the use of comments in this file. This parameter is required.- Returns:
this
-
newline
@Stability(Experimental) public JsonFile.Builder newline(Boolean newline)
(experimental) Adds a newline at the end of the file.Default: true
- Parameters:
newline- Adds a newline at the end of the file. This parameter is required.- Returns:
this
-
-