-
Notifications
You must be signed in to change notification settings - Fork 307
Expand file tree
/
Copy pathGitlabAccessLevel.java
More file actions
29 lines (25 loc) · 1002 Bytes
/
GitlabAccessLevel.java
File metadata and controls
29 lines (25 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package org.gitlab.api.models;
import com.fasterxml.jackson.annotation.JsonCreator;
// added MinimalAccess level 5 - for git 13.x and beyond
public enum GitlabAccessLevel {
Guest(10),
Reporter(20),
Developer(30),
Master(40),
MinimalAccess(5),
Owner(50);
public final int accessValue;
GitlabAccessLevel(int accessValue) {
this.accessValue = accessValue;
}
// http://fasterxml.github.io/jackson-annotations/javadoc/2.2.0/index.html?com/fasterxml/jackson/annotation/JsonCreator.html
@JsonCreator
public static GitlabAccessLevel fromAccessValue(final int accessValue) throws IllegalArgumentException {
for (final GitlabAccessLevel gitlabAccessLevel : GitlabAccessLevel.values()) {
if (gitlabAccessLevel.accessValue == accessValue) {
return gitlabAccessLevel;
}
}
throw new IllegalArgumentException("No GitLab Access Level enum constant with access value: " + accessValue);
}
}