Class ResourceName
- java.lang.Object
-
- migratedb.v1.core.api.internal.resource.ResourceName
-
public final class ResourceName extends Object
Represents a resource name, parsed into its components.Versioned and Undo migrations are named in the form prefixVERSIONseparatorDESCRIPTIONsuffix; Repeatable migrations and callbacks are named in the form prefixSeparatorDESCRIPTIONsuffix
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetDescription()The description of the resourceStringgetFilename()The filename of the resource as it appears on diskStringgetFilenameWithoutSuffix()The full name of the resourceStringgetPrefix()The prefix of the resource (eg.StringgetSuffix()The file type suffix of the resource (eg. ".sql" for SQL migration scripts)StringgetValidityMessage()If the resource name was not successfully parsed, an explanation of the problem.@Nullable VersiongetVersion()The version of the resource (eg. "1.2.3" for versioned migrations), or null for non-versioned resourcesstatic ResourceNameinvalid(String message)Construct a result representing an invalid resource namebooleanisValid()Whether the resource name was successfully parsed.
-
-
-
Method Detail
-
invalid
public static ResourceName invalid(String message)
Construct a result representing an invalid resource name- Parameters:
message- A message explaining the reason the resource name is invalid- Returns:
- The fully populated parsing result.
-
getPrefix
public String getPrefix()
The prefix of the resource (eg. "V" for versioned migrations)
-
getVersion
public @Nullable Version getVersion()
The version of the resource (eg. "1.2.3" for versioned migrations), or null for non-versioned resources
-
getDescription
public String getDescription()
The description of the resource
-
getSuffix
public String getSuffix()
The file type suffix of the resource (eg. ".sql" for SQL migration scripts)
-
getFilenameWithoutSuffix
public String getFilenameWithoutSuffix()
The full name of the resource
-
getFilename
public String getFilename()
The filename of the resource as it appears on disk
-
isValid
public boolean isValid()
Whether the resource name was successfully parsed.
-
getValidityMessage
public String getValidityMessage()
If the resource name was not successfully parsed, an explanation of the problem.
-
-