Package com.google.gerrit.common.data
Enum LabelFunction
- java.lang.Object
-
- java.lang.Enum<LabelFunction>
-
- com.google.gerrit.common.data.LabelFunction
-
- All Implemented Interfaces:
Serializable
,Comparable<LabelFunction>
public enum LabelFunction extends Enum<LabelFunction>
Functions for determining submittability based on label votes.Only describes built-in label functions. Admins can extend the logic arbitrarily using Prolog rules, in which case the choice of function in the project config is ignored.
Function semantics are documented in
config-labels.txt
, and actual behavior is implemented both in Prolog ingerrit_common.pl
and in thecheck(com.google.gerrit.common.data.LabelType, java.lang.Iterable<com.google.gerrit.entities.PatchSetApproval>)
method.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ANY_WITH_BLOCK
MAX_NO_BLOCK
MAX_WITH_BLOCK
NO_BLOCK
NO_OP
PATCH_SET_LOCK
-
Field Summary
Fields Modifier and Type Field Description static Map<String,LabelFunction>
ALL
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SubmitRecord.Label
check(LabelType labelType, Iterable<PatchSetApproval> approvals)
String
getFunctionName()
The function name as defined in documentation andproject.config
.boolean
isBlock()
Whether the label is a "block" label, meaning a minimum vote will prevent submission.boolean
isMaxValueRequired()
Whether the label requires a vote with the maximum value to allow submission.boolean
isRequired()
Whether the label is a mandatory label, meaning absence of votes will prevent submission.static Optional<LabelFunction>
parse(String str)
static LabelFunction
valueOf(String name)
Returns the enum constant of this type with the specified name.static LabelFunction[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
ANY_WITH_BLOCK
public static final LabelFunction ANY_WITH_BLOCK
-
MAX_WITH_BLOCK
public static final LabelFunction MAX_WITH_BLOCK
-
MAX_NO_BLOCK
public static final LabelFunction MAX_NO_BLOCK
-
NO_BLOCK
public static final LabelFunction NO_BLOCK
-
NO_OP
public static final LabelFunction NO_OP
-
PATCH_SET_LOCK
public static final LabelFunction PATCH_SET_LOCK
-
-
Field Detail
-
ALL
public static final Map<String,LabelFunction> ALL
-
-
Method Detail
-
values
public static LabelFunction[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (LabelFunction c : LabelFunction.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static LabelFunction valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
parse
public static Optional<LabelFunction> parse(String str)
-
getFunctionName
public String getFunctionName()
The function name as defined in documentation andproject.config
.
-
isBlock
public boolean isBlock()
Whether the label is a "block" label, meaning a minimum vote will prevent submission.
-
isRequired
public boolean isRequired()
Whether the label is a mandatory label, meaning absence of votes will prevent submission.
-
isMaxValueRequired
public boolean isMaxValueRequired()
Whether the label requires a vote with the maximum value to allow submission.
-
check
public SubmitRecord.Label check(LabelType labelType, Iterable<PatchSetApproval> approvals)
-
-