Package com.google.javascript.jscomp
Class SourceFile.Builder
- java.lang.Object
-
- com.google.javascript.jscomp.SourceFile.Builder
-
- Enclosing class:
- SourceFile
public static final class SourceFile.Builder extends java.lang.Object
A builder interface for source files.Allows users to customize the Charset, and the original path of the source file (if it differs from the path on disk).
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SourceFile
build()
SourceFile.Builder
withCharset(java.nio.charset.Charset charset)
Set the charset to use when reading from an input stream or file.SourceFile.Builder
withContent(java.io.InputStream x)
SourceFile.Builder
withContent(java.lang.String x)
SourceFile.Builder
withKind(StaticSourceFile.SourceKind kind)
Set the source kind.SourceFile.Builder
withOriginalPath(java.lang.String originalPath)
Sets a name for this source file that does not need to correspond to a path on disk.SourceFile.Builder
withPath(java.lang.String path)
SourceFile.Builder
withPath(java.nio.file.Path path)
SourceFile.Builder
withZipEntryPath(java.lang.String zipPath, java.lang.String entryPath)
-
-
-
Method Detail
-
withKind
@CanIgnoreReturnValue public SourceFile.Builder withKind(StaticSourceFile.SourceKind kind)
Set the source kind.
-
withCharset
@CanIgnoreReturnValue public SourceFile.Builder withCharset(java.nio.charset.Charset charset)
Set the charset to use when reading from an input stream or file.
-
withPath
public SourceFile.Builder withPath(java.lang.String path)
-
withPath
public SourceFile.Builder withPath(java.nio.file.Path path)
-
withContent
@CanIgnoreReturnValue public SourceFile.Builder withContent(java.lang.String x)
-
withContent
@CanIgnoreReturnValue @GwtIncompatible public SourceFile.Builder withContent(java.io.InputStream x)
-
withZipEntryPath
@CanIgnoreReturnValue public SourceFile.Builder withZipEntryPath(java.lang.String zipPath, java.lang.String entryPath)
-
withOriginalPath
@CanIgnoreReturnValue public SourceFile.Builder withOriginalPath(java.lang.String originalPath)
Sets a name for this source file that does not need to correspond to a path on disk.Allow passing a reasonable human-readable name in cases like for zip files and for generated files with unstable artifact prefixes.
The name must still be unique.
-
build
public SourceFile build()
-
-