Package org.openrewrite.remote
Interface Remote
- All Superinterfaces:
SourceFile,Tree
- All Known Implementing Classes:
RemoteArchive,RemoteFile
Represents a source hosted at a remote URI.
Downloading the remote file is not handled during Recipe execution. Post-processing of Recipe results by a build plugin or other caller of OpenRewrite is responsible for this.
Metadata like Charset or FileAttributes are supplied by the Recipe creating the Remote so that when the file is later downloaded it can be configured correctly. If no Charset is configured the downloaded file will be interpreted as binary data. If no FileAttributes are set the downloaded file will be marked as readable and writable but not executable. If a Checksum is provided it will be used to validate the integrity of the downloaded file.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiondefault <R extends Tree,P>
Raccept(TreeVisitor<R, P> v, P p) Supports polymorphic visiting viaTreeVisitor.visit(Tree, Object).static Remote.Builderstatic Remote.Builderstatic Remote.Builderbuilder(SourceFile before, URI uri) Any text describing what this remote URI represents.Download the remote filegetUri()default <P> booleanisAcceptable(TreeVisitor<?, P> v, P p) Checks the supplied argument to see if the supplied visitor and its context would be valid arguments to accept().default <P> StringprintAll(P p) default <P> StringprintAllTrimmed(P p) default <P> TreeVisitor<?,PrintOutputCapture<P>> default <T extends SourceFile>
TwithChecksum(@Nullable Checksum checksum) <R extends Remote>
RwithDescription(String description) <R extends Remote>
RMethods inherited from interface org.openrewrite.SourceFile
getCharset, getFileAttributes, getSourcePath, getStyle, getStyle, getWeight, isCharsetBomMarked, printAll, printAll, printAllAsBytes, printAllAsBytes, printAllTrimmed, printEqualsInput, service, withCharset, withCharsetBomMarked, withFileAttributes, withSourcePathMethods inherited from interface org.openrewrite.Tree
cast, getId, getJacksonPolymorphicTypeTag, getMarkers, isScope, print, print, print, printTrimmed, printTrimmed, printTrimmed, withId, withMarkers
-
Method Details
-
getUri
URI getUri() -
withUri
-
getDescription
String getDescription()Any text describing what this remote URI represents. Used to present human-readable results to an end user. -
withDescription
-
getChecksum
- Specified by:
getChecksumin interfaceSourceFile
-
withChecksum
- Specified by:
withChecksumin interfaceSourceFile
-
getInputStream
Download the remote file- Parameters:
ctx- used to download the file represented by this Remote
-
printAll
- Specified by:
printAllin interfaceSourceFile
-
printAllTrimmed
- Specified by:
printAllTrimmedin interfaceSourceFile
-
accept
Description copied from interface:TreeSupports polymorphic visiting viaTreeVisitor.visit(Tree, Object). This is useful in cases where an AST type contains a field that is of a type with a hierarchy. The visitor doesn't have to figure out which visit method to call by using instanceof. -
isAcceptable
Description copied from interface:TreeChecks the supplied argument to see if the supplied visitor and its context would be valid arguments to accept(). Typically, this involves checking that the visitor is of a type that operates on this kind of tree. e.g.: A Java Tree implementation would return true for JavaVisitors and false for MavenVisitors- Specified by:
isAcceptablein interfaceTree- Type Parameters:
P- the visitor's context argument- Returns:
- 'true' if the arguments to this function would be valid arguments to accept()
-
builder
-
builder
-
builder
-
printer
- Specified by:
printerin interfaceSourceFile- Specified by:
printerin interfaceTree
-