Package com.ericlam.mc.eld
Interface ServiceCollection
public interface ServiceCollection
服務註冊器
-
Method Summary
Modifier and TypeMethodDescription<T extends Configuration>
ServiceCollectionaddConfiguration(Class<T> config) 新增文件配置<T extends GroupConfiguration>
ServiceCollectionaddGroupConfiguration(Class<T> config) 新增文件池<T extends GroupLangConfiguration>
ServiceCollectionaddMultipleLanguages(Class<T> lang) 新增訊息文件池<T,L extends T>
ServiceCollectionaddService(Class<T> service, Class<L> implementation) 註冊服務, 如果已被註冊,則添加新的實作
使用依賴注入時,請使用Set<[Service]>進行註冊addServices(Class<T> service, Map<String, Class<? extends T>> implementations) 註冊含有多重實作方式的服務, 如果先前已有註冊,將直接添加新的實作
使用依賴注入時,請使用Map<String, [Service]>進行註冊addSingleton(Class<?> singleton) 註冊單例<T,L extends T>
ServiceCollectionbindService(Class<T> service, Class<L> implementation) 註冊服務<T,P extends javax.inject.Provider<T>>
ServiceCollectionbindServiceProvider(Class<T> service, Class<P> provider) 使用 Provider 註冊服務<T> TgetInstallation(Class<T> cls) 獲取自定義安裝器,沒有時拋出異常<T extends Overridable,L extends T>
ServiceCollectionoverrideService(Class<T> service, Class<L> implementation) 覆蓋服務
-
Method Details
-
addSingleton
註冊單例- Parameters:
singleton- 單例- Returns:
- this
-
bindService
註冊服務- Type Parameters:
T- 服務L- 實作- Parameters:
service- 服務類 (interface)implementation- 該服務的實作類- Returns:
- this
-
bindServiceProvider
<T,P extends javax.inject.Provider<T>> ServiceCollection bindServiceProvider(Class<T> service, Class<P> provider) 使用 Provider 註冊服務- Type Parameters:
T- 服務P- 提供器- Parameters:
service- 服務類 (interface)provider- 該服務的提供器- Returns:
- this
-
getInstallation
獲取自定義安裝器,沒有時拋出異常- Type Parameters:
T- 安裝類- Parameters:
cls- 安裝器類- Returns:
- this
-
overrideService
<T extends Overridable,L extends T> ServiceCollection overrideService(Class<T> service, Class<L> implementation) 覆蓋服務- Type Parameters:
T- 可覆蓋的服務L- 實作- Parameters:
service- 可覆蓋的服務類 (interface)implementation- 新的實作- Returns:
- this
-
addService
註冊服務, 如果已被註冊,則添加新的實作
使用依賴注入時,請使用Set<[Service]>進行註冊- Type Parameters:
T- 服務L- 實作- Parameters:
service- 服務類 (interface)implementation- 新的實作- Returns:
- this
-
addServices
註冊含有多重實作方式的服務, 如果先前已有註冊,將直接添加新的實作
使用依賴注入時,請使用Map<String, [Service]>進行註冊- Type Parameters:
T- 服務- Parameters:
service- 服務類 (interface)implementations- 包含標識id的多重實作類比- Returns:
- this
-
addConfiguration
新增文件配置- Type Parameters:
T- 映射物件類- Parameters:
config- 文件映射物件類- Returns:
- this
-
addGroupConfiguration
新增文件池- Type Parameters:
T- 映射物件類- Parameters:
config- 文件- Returns:
- this
-
addMultipleLanguages
新增訊息文件池- Type Parameters:
T- 映射物件類- Parameters:
lang- 訊息文件- Returns:
- this
-