Class CosIdStoreProviders

java.lang.Object
me.ahoo.cosid.spring.boot.starter.store.CosIdStoreProviders

public final class CosIdStoreProviders extends Object
Picks the CosIdStoreProvider of a store type.
Since:
3.4.0
  • 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, see StoreTypes. Fails naming the property that 4.0 removed when the provider property is still set.
      Parameters:
      environment - the application's environment
      typeKey - cosid.machine.distributor.type or cosid.segment.distributor.type
      providerKey - the removed provider property next to it
      type - the bound type
      defaultType - 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 of type that 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 of type creates it