java.lang.AutoCloseable
public static class ThreadLocalReason.Closable
extends java.lang.Object
implements java.lang.AutoCloseable
Example:
try (ThreadLocalReason.Closable closable = new ThreadLocalReason.Closable("Massban")) { // calls setCurrent("Massban")
List<Member> mentions = event.getMessage().getMentionedMembers();
GuildController controller = event.getGuild().getController();
mentions.stream()
.map(m -> controller.ban(m, 7))
.forEach(RestAction::queue);
} // calls resetCurrent()
Constructor | Description |
---|---|
Closable(java.lang.String reason) |
Modifier and Type | Method | Description |
---|---|---|
void |
close() |