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
A simple implementation of
Holder-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> voidaddEventConsumer(@NotNull Class<T> eventClass, @NotNull Consumer<T> eventConsumer) Add an event consumervoidClear all event consumersvoidclearEventConsumer(@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 idvoidhandleEvent(@NotNull Class<?> eventClass, @NotNull Object event) Handle the event<E> voidhandleEvent(E event) Handle the eventprotected abstract DnewDisplay(UUID uuid) Make a new displayprotected voidonRemoveDisplay(D display) Called when the display is removedvoidRemove all displaysvoidremoveDisplay(@NotNull UUID uuid) Remove a display with the unique idvoidstop()Stop the objectvoidupdate()Update the updatable objectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:HolderCreate a display with the unique id- Specified by:
createDisplayin interfaceHolder<D extends Display>- Parameters:
uuid- the unique id- Returns:
- the display
-
removeDisplay
Description copied from interface:HolderRemove a display with the unique id- Specified by:
removeDisplayin interfaceHolder<D extends Display>- Parameters:
uuid- the unique id
-
removeAllDisplay
public void removeAllDisplay()Description copied from interface:HolderRemove all displays- Specified by:
removeAllDisplayin interfaceHolder<D extends Display>
-
getDisplay
Description copied from interface:HolderGet the display for the unique id- Specified by:
getDisplayin interfaceHolder<D extends Display>- Parameters:
uuid- the unique id- Returns:
- the display
-
update
public void update()Description copied from interface:UpdatableUpdate the updatable object -
stop
public void stop()Description copied from interface:InitializableStop the object- Specified by:
stopin 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:HolderHandle the event- Specified by:
handleEventin interfaceHolder<D extends Display>- Parameters:
event- the event
-