Class FooterLine

java.lang.Object
org.eclipse.jgit.revwalk.FooterLine

public final class FooterLine extends Object
Single line at the end of a message, such as a "Signed-off-by: someone".

These footer lines tend to be used to represent additional information about a commit, like the path it followed through reviewers before finally being accepted into the project's main repository as an immutable commit.

See Also:
  • Method Details

    • fromMessage

      public static List<FooterLine> fromMessage(String str)
      Extract the footer lines from the given message.
      Parameters:
      str - the message to extract footers from.
      Returns:
      ordered list of footer lines; empty list if no footers found.
      Since:
      6.7
      See Also:
    • fromMessage

      public static List<FooterLine> fromMessage(byte[] raw)
      Extract the footer lines from the given message.
      Parameters:
      raw - the raw message to extract footers from.
      Returns:
      ordered list of footer lines; empty list if no footers found.
      Since:
      6.7
      See Also:
    • getValues

      public static List<String> getValues(List<FooterLine> footers, String keyName)
      Get the values of all footer lines with the given key.
      Parameters:
      footers - list of footers to find the values in.
      keyName - footer key to find values of, case-insensitive.
      Returns:
      values of footers with key of keyName, ordered by their order of appearance. Duplicates may be returned if the same footer appeared more than once. Empty list if no footers appear with the specified key, or there are no footers at all.
      Since:
      6.7
      See Also:
    • getValues

      public static List<String> getValues(List<FooterLine> footers, FooterKey key)
      Get the values of all footer lines with the given key.
      Parameters:
      footers - list of footers to find the values in.
      key - footer key to find values of, case-insensitive.
      Returns:
      values of footers with key of keyName, ordered by their order of appearance. Duplicates may be returned if the same footer appeared more than once. Empty list if no footers appear with the specified key, or there are no footers at all.
      Since:
      6.7
      See Also:
    • matches

      public boolean matches(FooterKey key)
      Whether keys match
      Parameters:
      key - key to test this line's key name against.
      Returns:
      true if key.getName().equalsIgnorecase(getKey()).
    • getKey

      public String getKey()
      Get key name of this footer.
      Returns:
      key name of this footer; that is the text before the ":" on the line footer's line. The text is decoded according to the commit's specified (or assumed) character encoding.
    • getValue

      public String getValue()
      Get value of this footer.
      Returns:
      value of this footer; that is the text after the ":" and any leading whitespace has been skipped. May be the empty string if the footer has no value (line ended with ":"). The text is decoded according to the commit's specified (or assumed) character encoding.
    • getEmailAddress

      public String getEmailAddress()
      Extract the email address (if present) from the footer.

      If there is an email address looking string inside of angle brackets (e.g. "<a@b>"), the return value is the part extracted from inside the brackets. If no brackets are found, then getValue() is returned if the value contains an '@' sign. Otherwise, null.

      Returns:
      email address appearing in the value of this footer, or null.
    • toString

      public String toString()
      Overrides:
      toString in class Object