Class IssueKey

java.lang.Object
com.atlassian.jira.issue.IssueKey

@ExperimentalApi public final class IssueKey extends Object
Represents an Issue Key, allowing you to parse it into its Project key and Issue number components.
  • Constructor Details

    • IssueKey

      public IssueKey(String projectKey, long issueNumber)
    • IssueKey

      public IssueKey(Project project, long issueNumber)
  • Method Details

    • getProjectKey

      public String getProjectKey()
    • getIssueNumber

      public long getIssueNumber()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • from

      public static IssueKey from(String key)
      Creates an IssueKey object form the given issue key String.

      This does some validation on the format of the given String. It must contain a dash ('-'), and the substring following the final dash must be a valid number. It validates that there is at least one character preceding the dash, but it does not validate that this is an existing key on this instance of JIRA.

      Parameters:
      key - The issue key as a string. eg "ABC_X20-1193"
      Returns:
      the corresponding IssueKey object.
      Throws:
      IllegalArgumentException - if the given String is not a valid JIRA Issue key
    • format

      public static String format(Project project, long issueNumber)
    • format

      public static String format(String projectKey, long issueNumber)
    • isValidKey

      public static boolean isValidKey(String issueKey)
      Returns true if the key is considered "valid"
      Parameters:
      issueKey - the key
      Returns:
      true if the key is considered "valid"