blob: dcb8eb97b8d995ca1fa3390a7e8666ce9f88b7dc (
plain) (
blame)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.jdisc;
import java.util.Objects;
/**
* Mapping from request to action
*
* @author mortent
*/
public interface AclMapping {
class Action {
public static final Action READ = new Action("read");
public static final Action WRITE = new Action("write");
private final String name;
public static Action custom(String name) {
return new Action(name);
}
private Action(String name) {
if(Objects.requireNonNull(name).isBlank()) {
throw new IllegalArgumentException("Name cannot be blank");
}
this.name = Objects.requireNonNull(name);
}
public String name() { return name; }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Action action = (Action) o;
return Objects.equals(name, action.name);
}
@Override
public int hashCode() {
return Objects.hash(name);
}
@Override
public String toString() {
return "Action{" +
"name='" + name + '\'' +
'}';
}
}
Action get(RequestView requestView);
}
|