blob: 1dce43bae67662b50472ae80b514aa65ffe5da24 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
package com.lumaserv.bgp.protocol;
import java.util.EnumSet;
import lombok.Getter;
import lombok.AllArgsConstructor;
@AllArgsConstructor
@Getter
public enum AFI {
IPV4(1, "IPv4"),
IPV6(2, "IPv6");
int value;
String desc;
public static AFI fromInteger(int value) {
return EnumSet.allOf(AFI.class).stream().filter(e -> e.getValue() == value).findAny().orElseThrow(
() -> new IllegalArgumentException("unknown address family: " + value));
}
}
|