1 /*
2 * Copyright (C) 2009, Google Inc. and others
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Distribution License v. 1.0 which is available at
6 * https://www.eclipse.org/org/documents/edl-v10.php.
7 *
8 * SPDX-License-Identifier: BSD-3-Clause
9 */
10
11 package org.eclipse.jgit.revwalk;
12
13 import java.util.Locale;
14
15 import org.eclipse.jgit.lib.Constants;
16
17 /**
18 * Case insensitive key for a {@link org.eclipse.jgit.revwalk.FooterLine}.
19 */
20 public final class FooterKey {
21 /** Standard {@code Signed-off-by} */
22 public static final FooterKey SIGNED_OFF_BY = new FooterKey("Signed-off-by"); //$NON-NLS-1$
23
24 /** Standard {@code Acked-by} */
25 public static final FooterKey ACKED_BY = new FooterKey("Acked-by"); //$NON-NLS-1$
26
27 /** Standard {@code CC} */
28 public static final FooterKey CC = new FooterKey("CC"); //$NON-NLS-1$
29
30 private final String name;
31
32 final byte[] raw;
33
34 /**
35 * Create a key for a specific footer line.
36 *
37 * @param keyName
38 * name of the footer line.
39 */
40 public FooterKey(String keyName) {
41 name = keyName;
42 raw = Constants.encode(keyName.toLowerCase(Locale.ROOT));
43 }
44
45 /**
46 * Get name of this footer line.
47 *
48 * @return name of this footer line.
49 */
50 public String getName() {
51 return name;
52 }
53
54 /** {@inheritDoc} */
55 @SuppressWarnings("nls")
56 @Override
57 public String toString() {
58 return "FooterKey[" + name + "]";
59 }
60 }