Interface IModuleContainer<T>
- All Known Subinterfaces:
IBuilding,IBuildingDeliveryman,IBuildingExtension,IBuildingModuleContainer,IBuildingWorker,IGuardBuilding,IMysticalSite,ITownHall,IWareHouse
- All Known Implementing Classes:
AbstractBuilding,AbstractBuildingContainer,AbstractBuildingExtension,AbstractBuildingGuards,AbstractBuildingMainWindow,AbstractBuildingStructureBuilder,AbstractBuildingWindow,AbstractModuleWindow,AbstractSchematicProvider,AbstractWindowCitizen,AbstractWindowSkeleton,AbstractWindowTownHall,AbstractWindowWorkerModuleBuilding,BuildingAlchemist,BuildingArchery,BuildingBaker,BuildingBarracks,BuildingBarracksTower,BuildingBeekeeper,BuildingBlacksmith,BuildingBuilder,BuildingChickenHerder,BuildingCombatAcademy,BuildingComposter,BuildingConcreteMixer,BuildingCook,BuildingCowboy,BuildingCrusher,BuildingDeliveryman,BuildingDyer,BuildingEnchanter,BuildingFarmer,BuildingFisherman,BuildingFletcher,BuildingFlorist,BuildingGateHouse,BuildingGlassblower,BuildingGraveyard,BuildingGuardTower,BuildingHospital,BuildingKitchen,BuildingLibrary,BuildingLumberjack,BuildingMechanic,BuildingMiner,BuildingMysticalSite,BuildingNetherWorker,BuildingPlantation,BuildingRabbitHutch,BuildingSawmill,BuildingSchool,BuildingShepherd,BuildingSifter,BuildingSmeltery,BuildingStable,BuildingStonemason,BuildingStoneSmeltery,BuildingSwineHerder,BuildingTownHall,BuildingUniversity,BuildingWareHouse,ConnectionModuleWindow,DebugWindowCitizen,DefaultBuildingInstance,DOCraftingWindow,EnchanterStationModuleWindow,EntityListModuleWindow,ExpeditionLogModuleWindow,FamilyWindowCitizen,FarmField,FarmFieldsModuleWindow,FoodItemListModuleWindow,GraveyardManagementWindow,HappinessWindowCitizen,ItemListModuleWindow,JobWindowCitizen,MainWindowCitizen,MinimumStockModuleWindow,PlantationField,PlantationFieldsModuleWindow,PostBox,RequestWindowCitizen,RestaurantMenuModuleWindow,SettingsModuleWindow,SpecialAssignmentModuleWindow,Stash,ToolModuleWindow,UniversityModuleWindow,WarehouseOptionsModuleWindow,WindowAlliancePage,WindowAssignCitizen,WindowBannerRallyGuards,WindowBarracksBuilding,WindowBuildBuilding,WindowBuildDecoration,WindowBuilderResModule,WindowBuildingBrowser,WindowCitizenPage,WindowClipBoard,WindowColonyMap,WindowColonyPrestigeRanking,WindowConfirm,WindowDecorationController,WindowField,WindowHireWorker,WindowHutAllInventory,WindowHutBuilderModule,WindowHutGuide,WindowHutLiving,WindowHutMinerModule,WindowHutMinPlaceholder,WindowHutRequestTaskModule,WindowHutWorkerModulePlaceholder,WindowInfo,WindowInfoPage,WindowInteraction,WindowListRecipes,WindowMainPage,WindowMineGuardModule,WindowPermissionsPage,WindowPlantationField,WindowPostBoxMain,WindowPostBoxMinStock,WindowQuestLog,WindowReactivateBuilding,WindowRequestDetail,WindowResearchTree,WindowResourceList,WindowSchematicAnalyzer,WindowSelectRequest,WindowSettings,WindowStatsModule,WindowStatsPage,WindowSuggestBuildTool,WindowSupplyStory,WindowTownHallCantCreateColony,WindowTownHallColonyManage,WindowTownHallColonyReactivate,WindowTownHallDeleteAbandonColony,WorkOrderModuleWindow
public interface IModuleContainer<T>
Default interface for objects that contain module instances.
-
Method Summary
Modifier and TypeMethodDescriptionGet the class type of the module container.default <T2 extends T>
T2getFirstModuleOccurance(Class<T2> clazz) Deprecated.default <T2 extends T>
T2Get a specific module that extends from the given class.default <T2 extends T>
T2Get a specific module that extends from the given class and matches the given predicate.default TGet a specific module that that matches the given predicate.default <T2 extends T>
T2getModuleMatching(Class<T2> clazz, Predicate<T2> modulePredicate) Deprecated.switch togetModule(Class)Get a list containing all modules registered to this container.getModules(Class<T2> clazz) Get a list containing all modules that extend from the given class.getModules(Class<T2> clazz, Predicate<T2> predicate) Get a list containing all modules that extend from the given class and match the given predicate.getModules(Predicate<T> predicate) Get a list containing all modules that match the given predicate.getModulesByType(Class<T2> clazz) Deprecated.default <T2 extends T>
booleanCheck if a certain module exists that extends from the given class.default <T2 extends T>
booleanCheck if a certain module exists that extends from the given class and matches the given predicate.default booleanCheck if a certain module exists that matches the given predicate.
-
Method Details
-
getModules
Get a list containing all modules registered to this container.- Returns:
- the list of all modules.
-
getClassType
Get the class type of the module container.- Returns:
- the class type.
-
getModules
Get a list containing all modules that extend from the given class.- Type Parameters:
T2- the generic type of the specific classes we're looking for.- Parameters:
clazz- the class type to check against.- Returns:
- the list of modules.
-
getModules
Get a list containing all modules that match the given predicate.- Parameters:
predicate- the predicate to check each module against.- Returns:
- the list of modules.
-
getModules
@NotNull default <T2 extends T> @NotNull List<T2> getModules(Class<T2> clazz, Predicate<T2> predicate) Get a list containing all modules that extend from the given class and match the given predicate.- Type Parameters:
T2- the generic type of the specific classes we're looking for.- Parameters:
clazz- the class type to check against.predicate- the predicate to check each module against.- Returns:
- the list of modules.
-
getModule
Get a specific module that extends from the given class.- Type Parameters:
T2- the generic type of the specific classes we're looking for.- Parameters:
clazz- the class type to check against.- Returns:
- the found module, or null.
-
getModule
Get a specific module that that matches the given predicate.- Parameters:
predicate- the predicate to check each module against.- Returns:
- the found module, or null.
-
getModule
Get a specific module that extends from the given class and matches the given predicate.- Type Parameters:
T2- the generic type of the specific classes we're looking for.- Parameters:
clazz- the class type to check against.predicate- the predicate to check each module against.- Returns:
- the found module, or null.
-
hasModule
Check if a certain module exists that extends from the given class.- Type Parameters:
T2- the generic type of the specific classes we're looking for.- Parameters:
clazz- the class type to check against.- Returns:
- true if the module was found.
-
hasModule
Check if a certain module exists that matches the given predicate.- Parameters:
predicate- the predicate to check each module against.- Returns:
- true if the module was found.
-
hasModule
Check if a certain module exists that extends from the given class and matches the given predicate.- Type Parameters:
T2- the generic type of the specific classes we're looking for.- Parameters:
clazz- the class type to check against.predicate- the predicate to check each module against.- Returns:
- true if the module was found.
-
getFirstModuleOccurance
Deprecated.switch togetModule(Class)Get the first module with a particular class or interface.- Parameters:
clazz- the module's class or interface.- Returns:
- the module or empty if not existent.
-
getModuleMatching
@Deprecated @NotNull default <T2 extends T> T2 getModuleMatching(Class<T2> clazz, Predicate<T2> modulePredicate) Deprecated.switch togetModule(Class)Get a module matching a certain predicate.- Type Parameters:
T2- the module type.- Parameters:
modulePredicate- the predicate to match.- Returns:
- the first matching module.
- Throws:
IllegalArgumentException- if your condition does not match any modules
-
getModulesByType
Deprecated.Get all modules with a particular class or interface.- Parameters:
clazz- the module's interface (or class, but prefer getModule in that case)- Returns:
- the list of modules or empty if none match.
-
getModule(Class)