Class DefaultTokenBucket.Builder
- java.lang.Object
-
- org.onosproject.net.behaviour.trafficcontrol.DefaultTokenBucket.Builder
-
- All Implemented Interfaces:
TokenBucket.Builder
- Enclosing class:
- DefaultTokenBucket
public static final class DefaultTokenBucket.Builder extends Object implements TokenBucket.Builder
Implementation of the token bucket builder interface.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DefaultTokenBucket
build()
Builds the token bucket based on the specified parameters when possible.TokenBucket.Builder
withAction(TokenBucket.Action a)
Assigns the action to this token bucket.TokenBucket.Builder
withBurstSize(long bS)
Assigns the burst size to this token bucket.TokenBucket.Builder
withDscp(short d)
Assigns the dscp value to this token bucket.TokenBucket.Builder
withRate(long r)
Assigns the rate to this token bucket.TokenBucket.Builder
withType(TokenBucket.Type t)
Assigns the type to this token bucket.
-
-
-
Method Detail
-
withRate
public TokenBucket.Builder withRate(long r)
Description copied from interface:TokenBucket.Builder
Assigns the rate to this token bucket.- Specified by:
withRate
in interfaceTokenBucket.Builder
- Parameters:
r
- a rate value- Returns:
- this
-
withBurstSize
public TokenBucket.Builder withBurstSize(long bS)
Description copied from interface:TokenBucket.Builder
Assigns the burst size to this token bucket. Default to 2 * 1500 bytes.- Specified by:
withBurstSize
in interfaceTokenBucket.Builder
- Parameters:
bS
- a burst size- Returns:
- this
-
withAction
public TokenBucket.Builder withAction(TokenBucket.Action a)
Description copied from interface:TokenBucket.Builder
Assigns the action to this token bucket.Note: mandatory setter for this builder
- Specified by:
withAction
in interfaceTokenBucket.Builder
- Parameters:
a
- an action- Returns:
- this
-
withDscp
public TokenBucket.Builder withDscp(short d)
Description copied from interface:TokenBucket.Builder
Assigns the dscp value to this token bucket.- Specified by:
withDscp
in interfaceTokenBucket.Builder
- Parameters:
d
- a dscp value- Returns:
- this
-
withType
public TokenBucket.Builder withType(TokenBucket.Type t)
Description copied from interface:TokenBucket.Builder
Assigns the type to this token bucket.Note: mandatory setter for this builder
- Specified by:
withType
in interfaceTokenBucket.Builder
- Parameters:
t
- the type- Returns:
- this
-
build
public DefaultTokenBucket build()
Description copied from interface:TokenBucket.Builder
Builds the token bucket based on the specified parameters when possible.- Specified by:
build
in interfaceTokenBucket.Builder
- Returns:
- a token bucket
-
-