Class CosIdStoreProviders
java.lang.Object
me.ahoo.cosid.spring.boot.starter.store.CosIdStoreProviders
Picks the
CosIdStoreProvider of a store type.- Since:
- 3.4.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Tcreate(String type, List<CosIdStoreProvider> providers, Function<CosIdStoreProvider, T> create, String what) Create with the first provider oftypethat supports it: the application's providers first, in their order, then the built-in ones.static StringstoreType(org.springframework.core.env.PropertyResolver environment, String typeKey, String providerKey, @Nullable String type, String defaultType) The store type a distributor setting selects, seeStoreTypes.
-
Method Details
-
storeType
public static String storeType(org.springframework.core.env.PropertyResolver environment, String typeKey, String providerKey, @Nullable String type, String defaultType) The store type a distributor setting selects, seeStoreTypes. Fails naming the property that 4.0 removed when theproviderproperty is still set.- Parameters:
environment- the application's environmenttypeKey-cosid.machine.distributor.typeorcosid.segment.distributor.typeproviderKey- the removedproviderproperty next to ittype- the bound typedefaultType- the type when unset
-
create
public static <T> T create(String type, List<CosIdStoreProvider> providers, Function<CosIdStoreProvider, T> create, String what) Create with the first provider oftypethat supports it: the application's providers first, in their order, then the built-in ones.- Parameters:
what- describes what is created, for the error message- Throws:
IllegalStateException- if no provider oftypecreates it
-