Interface IModuleContainerView
- All Known Subinterfaces:
IBuildingView,IBuildingWorkerView,ITownHallView
- All Known Implementing Classes:
AbstractBuildingBuilderView,AbstractBuildingGuards.View,AbstractBuildingView,BuildingBarracks.View,BuildingBeekeeper.View,BuildingBuilder.View,BuildingCook.View,BuildingGateHouse.View,BuildingGuardTower.View,BuildingLumberjack.View,BuildingMysticalSite.View,BuildingTownHall.View,BuildingWareHouse.View,EmptyView,HomeBuildingModule.View,LivingBuildingView,PostBox.View,TavernBuildingModule.View
public interface IModuleContainerView
-
Method Summary
Modifier and TypeMethodDescriptionGet all module views in a list.getModuleView(int id) Get the first module with a particular class or interface.<M extends IBuildingModule,V extends IBuildingModuleView>
VgetModuleView(BuildingEntry.ModuleProducer<M, V> producer) Get the first module with a particular class or interface.<T extends IBuildingModuleView>
TgetModuleViewByType(Class<T> clazz) Get the first module view matching the class.<T extends IBuildingModuleView>
TgetModuleViewMatching(Class<T> clazz, Predicate<? super T> modulePredicate) Get the module view matching a certain predicate.<T extends IBuildingModuleView>
List<T> getModuleViews(Class<T> clazz) Get a list of all modules matching a specific class.booleanhasModuleView(BuildingEntry.ModuleProducer producer) Check if the object has a particular module.voidregisterModule(IBuildingModuleView iModuleView) Register a view module with the building.
-
Method Details
-
getModuleViewByType
Get the first module view matching the class.- Type Parameters:
T- the type of module returned.- Parameters:
clazz- the class to match.- Returns:
- the module.
-
getModuleView
Get the first module with a particular class or interface.- Returns:
- the module or empty if not existent.
-
getModuleView
<M extends IBuildingModule,V extends IBuildingModuleView> V getModuleView(BuildingEntry.ModuleProducer<M, V> producer) Get the first module with a particular class or interface.- Returns:
- the module or empty if not existent.
-
hasModuleView
Check if the object has a particular module.- Parameters:
producer- the module producer for the module- Returns:
- true if so.
-
getModuleViewMatching
@Nullable <T extends IBuildingModuleView> T getModuleViewMatching(Class<T> clazz, Predicate<? super T> modulePredicate) Get the module view matching a certain predicate.- Type Parameters:
T- the optional type.- Parameters:
clazz- the class of the module.modulePredicate- the predicate to match.- Returns:
- the module.
-
getModuleViews
Get a list of all modules matching a specific class.- Type Parameters:
T- the type of module.- Parameters:
clazz- the class to match.- Returns:
- the list or empty if doesn't exist.
-
registerModule
Register a view module with the building.- Parameters:
iModuleView- the view.
-
getAllModuleViews
List<IBuildingModuleView> getAllModuleViews()Get all module views in a list.- Returns:
- the list of views.
-