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 Type
    Method
    Description
    @NotNull Class<T>
    Get the class type of the module container.
    default <T2 extends T>
    T2
    Deprecated.
    default <T2 extends T>
    T2
    getModule(Class<T2> clazz)
    Get a specific module that extends from the given class.
    default <T2 extends T>
    T2
    getModule(Class<T2> clazz, Predicate<T2> predicate)
    Get a specific module that extends from the given class and matches the given predicate.
    default T
    getModule(Predicate<T> predicate)
    Get a specific module that that matches the given predicate.
    default <T2 extends T>
    T2
    getModuleMatching(Class<T2> clazz, Predicate<T2> modulePredicate)
    Deprecated.
    @NotNull List<T>
    Get a list containing all modules registered to this container.
    default <T2 extends T>
    @NotNull List<T2>
    getModules(Class<T2> clazz)
    Get a list containing all modules that extend from the given class.
    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.
    default @NotNull List<T>
    getModules(Predicate<T> predicate)
    Get a list containing all modules that match the given predicate.
    default <T2 extends T>
    @NotNull List<T2>
    Deprecated.
    default <T2 extends T>
    boolean
    hasModule(Class<T2> clazz)
    Check if a certain module exists that extends from the given class.
    default <T2 extends T>
    boolean
    hasModule(Class<T2> clazz, Predicate<T2> predicate)
    Check if a certain module exists that extends from the given class and matches the given predicate.
    default boolean
    hasModule(Predicate<T> predicate)
    Check if a certain module exists that matches the given predicate.
  • Method Details

    • getModules

      @NotNull @NotNull List<T> getModules()
      Get a list containing all modules registered to this container.
      Returns:
      the list of all modules.
    • getClassType

      @NotNull @NotNull Class<T> getClassType()
      Get the class type of the module container.
      Returns:
      the class type.
    • getModules

      @NotNull default <T2 extends T> @NotNull List<T2> getModules(Class<T2> clazz)
      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

      @NotNull default @NotNull List<T> getModules(Predicate<T> predicate)
      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

      @Nullable default <T2 extends T> T2 getModule(Class<T2> clazz)
      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

      @Nullable default T getModule(Predicate<T> predicate)
      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

      @Nullable default <T2 extends T> T2 getModule(Class<T2> clazz, Predicate<T2> predicate)
      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

      default <T2 extends T> boolean hasModule(Class<T2> clazz)
      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

      default boolean hasModule(Predicate<T> predicate)
      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

      default <T2 extends T> boolean hasModule(Class<T2> clazz, Predicate<T2> predicate)
      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 @NotNull default <T2 extends T> T2 getFirstModuleOccurance(Class<T2> clazz)
      Deprecated.
      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.
      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 @NotNull default <T2 extends T> @NotNull List<T2> getModulesByType(Class<T2> clazz)
      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.