Package me.hsgamer.hscore.ui
Class BaseHolder<D extends Display>
java.lang.Object
me.hsgamer.hscore.ui.BaseHolder<D>
- Type Parameters:
D
- The type ofDisplay
- All Implemented Interfaces:
Holder<D>
,Initializable
,Updatable
- Direct Known Subclasses:
GUIHolder
A simple implementation of
Holder
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T> void
addEventConsumer
(@NotNull Class<T> eventClass, @NotNull Consumer<T> eventConsumer) Add an event consumervoid
Clear all event consumersvoid
clearEventConsumer
(@NotNull Class<?> eventClass) Clear the event consumercreateDisplay
(@NotNull UUID uuid) Create a display with the unique idgetDisplay
(@NotNull UUID uuid) Get the display for the unique idvoid
handleEvent
(@NotNull Class<?> eventClass, @NotNull Object event) Handle the event<E> void
handleEvent
(E event) Handle the eventprotected abstract D
newDisplay
(UUID uuid) Make a new displayprotected void
onRemoveDisplay
(D display) Called when the display is removedvoid
Remove all displaysvoid
removeDisplay
(@NotNull UUID uuid) Remove a display with the unique idvoid
stop()
Stop the objectvoid
update()
Update the updatable objectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface me.hsgamer.hscore.ui.property.Initializable
init
-
Field Details
-
displayMap
-
-
Constructor Details
-
BaseHolder
public BaseHolder()
-
-
Method Details
-
newDisplay
Make a new display- Parameters:
uuid
- the unique id- Returns:
- the display
-
onRemoveDisplay
Called when the display is removed- Parameters:
display
- the display
-
createDisplay
Description copied from interface:Holder
Create a display with the unique id- Specified by:
createDisplay
in interfaceHolder<D extends Display>
- Parameters:
uuid
- the unique id- Returns:
- the display
-
removeDisplay
Description copied from interface:Holder
Remove a display with the unique id- Specified by:
removeDisplay
in interfaceHolder<D extends Display>
- Parameters:
uuid
- the unique id
-
removeAllDisplay
public void removeAllDisplay()Description copied from interface:Holder
Remove all displays- Specified by:
removeAllDisplay
in interfaceHolder<D extends Display>
-
getDisplay
Description copied from interface:Holder
Get the display for the unique id- Specified by:
getDisplay
in interfaceHolder<D extends Display>
- Parameters:
uuid
- the unique id- Returns:
- the display
-
update
public void update()Description copied from interface:Updatable
Update the updatable object -
stop
public void stop()Description copied from interface:Initializable
Stop the object- Specified by:
stop
in interfaceInitializable
-
addEventConsumer
public <T> void addEventConsumer(@NotNull @NotNull Class<T> eventClass, @NotNull @NotNull Consumer<T> eventConsumer) Add an event consumer- Type Parameters:
T
- the type of the event- Parameters:
eventClass
- the class of the eventeventConsumer
- the consumer
-
clearEventConsumer
Clear the event consumer- Parameters:
eventClass
- the class of the event
-
clearAllEventConsumer
public void clearAllEventConsumer()Clear all event consumers -
handleEvent
Handle the event- Parameters:
eventClass
- the class of the eventevent
- the event
-
handleEvent
public <E> void handleEvent(@NotNull E event) Description copied from interface:Holder
Handle the event- Specified by:
handleEvent
in interfaceHolder<D extends Display>
- Parameters:
event
- the event
-