java.lang.Object
com.github.cowwoc.tokenbucket.Bucket.Builder
- Enclosing class:
- Bucket
Builds a bucket.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddLimit(Function<Limit.Builder, Limit> limitBuilder) Adds a limit that the bucket must respect.addListener(ContainerListener listener) Adds an event listener to the bucket.build()Builds a new Bucket.limits()Returns the limits that the bucket must respect.Returns the event listeners associated with this bucket.toString()userData()Returns the user data associated with this bucket.Sets user data associated with this bucket.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
limits
Returns the limits that the bucket must respect.- Returns:
- the limits that the bucket must respect
-
addLimit
Adds a limit that the bucket must respect.- Parameters:
limitBuilder- builds the Limit- Returns:
- this
- Throws:
NullPointerException- if any of the arguments are null
-
listeners
Returns the event listeners associated with this bucket.- Returns:
- this
-
addListener
Adds an event listener to the bucket.- Parameters:
listener- a listener- Returns:
- this
- Throws:
NullPointerException- iflisteneris null
-
userData
Returns the user data associated with this bucket.- Returns:
- the data associated with this bucket
-
userData
Sets user data associated with this bucket.- Parameters:
userData- the data associated with this bucket- Returns:
- this
-
build
Builds a new Bucket.- Returns:
- a new Bucket
-
toString
-