Package org.flywaydb.core.api
Class Location
- java.lang.Object
-
- org.flywaydb.core.api.Location
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringFILESYSTEM_PREFIXThe prefix for filesystem locations.
-
Constructor Summary
Constructors Constructor Description Location(java.lang.String descriptor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Location o)booleanequals(java.lang.Object o)java.lang.StringgetDescriptor()java.lang.StringgetPath()java.util.regex.PatterngetPathRegex()java.lang.StringgetPathRelativeToThis(java.lang.String path)Returns the path relative to this location.java.lang.StringgetPrefix()java.lang.StringgetRootPath()The first folder in the path.inthashCode()booleanisAwsS3()Checks whether this denotes a location in AWS S3.booleanisClassPath()Checks whether this denotes a location on the classpath.booleanisFileSystem()Checks whether this denotes a location on the filesystem.booleanisGCS()Checks whether this denotes a location in Google cloud storage.booleanisParentOf(Location other)Checks whether this location is a parent of this other location.booleanmatchesPath(java.lang.String path)java.lang.StringtoString()
-
-
-
Field Detail
-
FILESYSTEM_PREFIX
public static final java.lang.String FILESYSTEM_PREFIX
The prefix for filesystem locations.- See Also:
- Constant Field Values
-
-
Method Detail
-
matchesPath
public boolean matchesPath(java.lang.String path)
- Returns:
- Whether the given path matches this locations regex. Will always return true when the location did not contain any wildcards.
-
getPathRelativeToThis
public java.lang.String getPathRelativeToThis(java.lang.String path)
Returns the path relative to this location. If the location path contains wildcards, the returned path will be relative to the last non-wildcard folder in the path.
-
isClassPath
public boolean isClassPath()
Checks whether this denotes a location on the classpath.- Returns:
trueif it does,falseif it doesn't.
-
isFileSystem
public boolean isFileSystem()
Checks whether this denotes a location on the filesystem.- Returns:
trueif it does,falseif it doesn't.
-
isAwsS3
public boolean isAwsS3()
Checks whether this denotes a location in AWS S3.- Returns:
trueif it does,falseif it doesn't;
-
isGCS
public boolean isGCS()
Checks whether this denotes a location in Google cloud storage.- Returns:
trueif it does,falseif it doesn't;
-
isParentOf
public boolean isParentOf(Location other)
Checks whether this location is a parent of this other location.- Parameters:
other- The other location.- Returns:
trueif it is,falseif it isn't.
-
getPath
public java.lang.String getPath()
- Returns:
- The path part of the location.
-
getDescriptor
public java.lang.String getDescriptor()
- Returns:
- The complete location descriptor.
-
compareTo
public int compareTo(Location o)
- Specified by:
compareToin interfacejava.lang.Comparable<Location>
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Returns:
- The complete location descriptor.
-
getPrefix
public java.lang.String getPrefix()
- Returns:
- The prefix part of the location. Can be either classpath: or filesystem:.
-
getRootPath
public java.lang.String getRootPath()
The first folder in the path. This will equal rawPath if the path does not contain any wildcards- Returns:
- The root part of the path part of the location.
-
getPathRegex
public java.util.regex.Pattern getPathRegex()
- Returns:
- The regex that matches wildcards in the original path. Null if the original path did not contain any wildcards.
-
-