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

  • Constructor Details

  • Method Details

    • 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.