Class BuiltInStoreProvider
java.lang.Object
me.ahoo.cosid.spring.boot.starter.store.BuiltInStoreProvider
- All Implemented Interfaces:
CosIdStoreProvider,org.springframework.core.Ordered
public final class BuiltInStoreProvider
extends Object
implements CosIdStoreProvider, org.springframework.core.Ordered
A provider registered by one of the starter's own auto-configurations. A provider of the application with the same
type takes precedence over it.
- Since:
- 3.4.0
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Method Summary
Modifier and TypeMethodDescription@Nullable IdSegmentDistributorFactoryCreate the id segment distributor factory.@Nullable MachineIdDistributorCreate the machine id distributor.intgetOrder()getType()The store type this provider serves, compared ignoring case.static BuiltInStoreProvidermachine(String type, Function<MachineStoreContext, MachineIdDistributor> machine) static BuiltInStoreProvidersegment(String type, int order, Function<SegmentStoreContext, IdSegmentDistributorFactory> segment) A segment provider ranked byorderamong built-in providers of the same type.static BuiltInStoreProvidersegment(String type, Function<SegmentStoreContext, IdSegmentDistributorFactory> segment) toString()
-
Method Details
-
machine
public static BuiltInStoreProvider machine(String type, Function<MachineStoreContext, MachineIdDistributor> machine) -
segment
public static BuiltInStoreProvider segment(String type, Function<SegmentStoreContext, IdSegmentDistributorFactory> segment) -
segment
public static BuiltInStoreProvider segment(String type, int order, Function<SegmentStoreContext, IdSegmentDistributorFactory> segment) A segment provider ranked byorderamong built-in providers of the same type. -
getType
Description copied from interface:CosIdStoreProviderThe store type this provider serves, compared ignoring case.- Specified by:
getTypein interfaceCosIdStoreProvider
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-
createMachineIdDistributor
Description copied from interface:CosIdStoreProviderCreate the machine id distributor.- Specified by:
createMachineIdDistributorin interfaceCosIdStoreProvider- Returns:
- the distributor, or
nullif this provider has none
-
createIdSegmentDistributorFactory
public @Nullable IdSegmentDistributorFactory createIdSegmentDistributorFactory(SegmentStoreContext context) Description copied from interface:CosIdStoreProviderCreate the id segment distributor factory.- Specified by:
createIdSegmentDistributorFactoryin interfaceCosIdStoreProvider- Returns:
- the factory, or
nullif this provider has none
-
toString
-