Class MicroRooms<Room extends MicroRoom>
java.lang.Object
com.iohao.net.common.kit.micro.room.MicroRooms<Room>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd a room to the registry.booleancontains(long id) Check if a room with the given ID exists.getRoom(long id) Get the room with the given ID.ofRoom(long id) Get the room by ID, creating it if absent.optionalRoom(long id) Get the room with the given ID as anOptional.remove(long id) Remove the room with the given ID.voidsetRoomSupplier(Supplier<Room> roomSupplier) stream()Return a stream of all rooms in the registry.
-
Constructor Details
-
MicroRooms
public MicroRooms()
-
-
Method Details
-
contains
public boolean contains(long id) Check if a room with the given ID exists.- Parameters:
id- the room ID- Returns:
trueif the room exists
-
remove
Remove the room with the given ID.- Parameters:
id- the room ID- Returns:
- the removed room, or
nullif not found
-
getRoom
Get the room with the given ID.- Parameters:
id- the room ID- Returns:
- the room, or
nullif not found
-
add
-
optionalRoom
-
ofRoom
Get the room by ID, creating it if absent.- Parameters:
id- roomId- Returns:
- the room instance
-
stream
-
getRoomMap
-
setRoomSupplier
-