Package dev.voidframework.bucket4j
Class BucketTokenRegistry
java.lang.Object
dev.voidframework.bucket4j.BucketTokenRegistry
This is a factory to create Bucket instances which
stores all Bucket instances in a registry.
- Since:
- 1.9.0
-
Constructor Summary
ConstructorsConstructorDescriptionBucketTokenRegistry(com.typesafe.config.Config configuration) Build a new instance.BucketTokenRegistry(com.typesafe.config.Config configuration, Map<String, io.github.bucket4j.Bucket> initialBuckets) Build a new instance. -
Method Summary
Modifier and TypeMethodDescriptionio.github.bucket4j.BucketReturns a managed Bucket or create a new one.io.github.bucket4j.BucketReturns a managed Bucket or create a new one from the given configuration path.io.github.bucket4j.BucketbucketOrDie(String bucketName) Returns a managed Bucket or throw an exception if not exist.Returns all managed Bucket instances.
-
Constructor Details
-
BucketTokenRegistry
public BucketTokenRegistry(com.typesafe.config.Config configuration) Build a new instance.- Parameters:
configuration- The application configuration- Since:
- 1.9.0
-
BucketTokenRegistry
public BucketTokenRegistry(com.typesafe.config.Config configuration, Map<String, io.github.bucket4j.Bucket> initialBuckets) Build a new instance.- Parameters:
configuration- The application configurationinitialBuckets- Initial Buckets- Since:
- 1.9.0
-
-
Method Details
-
bucketOrDie
Returns a managed Bucket or throw an exception if not exist.- Parameters:
bucketName- The name of the Bucket- Returns:
- The Bucket
- Since:
- 1.9.0
- See Also:
-
bucket
Returns a managed Bucket or create a new one. All setting keys to configure Bucket must exist into "voidframework.bucket4j.<bucketName>".- Parameters:
bucketName- The name of the Bucket- Returns:
- The Bucket
- Since:
- 1.9.0
-
bucket
Returns a managed Bucket or create a new one from the given configuration path. If Bucket does not exist and "configurationPath" parameter isnull, the exceptionBucketDoesNotExistwill be thrown.- Parameters:
bucketName- The name of the BucketconfigurationPath- The configuration path to use during Bucket creation process- Returns:
- The Bucket
- Since:
- 1.9.0
- See Also:
-
getAllBuckets
Returns all managed Bucket instances.- Returns:
- All managed Bucket instances.
- Since:
- 1.9.0
-