mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
Implement SessionEncoder and SessionParser
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package org.briarproject.briar.api.introduction2;
|
||||
|
||||
import org.briarproject.bramble.api.FormatException;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
||||
@Immutable
|
||||
@NotNullByDefault
|
||||
public enum Role {
|
||||
|
||||
INTRODUCER(0), INTRODUCEE(1);
|
||||
|
||||
private final int value;
|
||||
|
||||
Role(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static Role fromValue(int value) throws FormatException {
|
||||
for (Role r : values()) if (r.value == value) return r;
|
||||
throw new FormatException();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user