public static Right forChar(char c) throws UnsupportedRightException { return Right.allRights .stream() .filter(r -> r.asCharacter() == c) .findFirst() .orElseThrow(() -> new UnsupportedRightException(c)); } }
@JsonValue public char asCharacter() { return right.asCharacter(); }
/** * Tells whether the implementation supports the given right. * * @param right * @return true if this supports the given right. */ public boolean isSupported(Right right) { try { contains(right.asCharacter()); return true; } catch (UnsupportedRightException e) { return false; } }
public UnsupportedRightException(Right unsupportedRight) { this(unsupportedRight.asCharacter()); }