Class DefaultPolicer.Builder
- java.lang.Object
-
- org.onosproject.net.behaviour.trafficcontrol.DefaultPolicer.Builder
-
- All Implemented Interfaces:
Policer.Builder
- Enclosing class:
- DefaultPolicer
public static final class DefaultPolicer.Builder extends java.lang.Object implements Policer.Builder
Implementation of the policer builder interface.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DefaultPolicer
build()
Builds the policer based on the specified parameters when possible.Policer.Builder
colorAware(boolean isColorAware)
Sets this policer to be color aware.Policer.Builder
forDeviceId(DeviceId dId)
Assigns the device for this policer.Policer.Builder
fromApp(ApplicationId appId)
Assigns the application that built this policer.Policer.Builder
withDescription(java.lang.String d)
Assigns description for this policer.Policer.Builder
withId(PolicerId id)
Assigns the id to this policer.Policer.Builder
withPolicingResource(PolicingResource policingResource)
Assigns policer id and device id for this policer.Policer.Builder
withTokenBuckets(java.util.Collection<TokenBucket> tB)
Assigns token buckets for this policer.Policer.Builder
withUnit(Policer.Unit u)
Assigns the unit to use for this policer.
-
-
-
Method Detail
-
forDeviceId
public Policer.Builder forDeviceId(DeviceId dId)
Description copied from interface:Policer.Builder
Assigns the device for this policer.Note: mandatory setter for this builder
- Specified by:
forDeviceId
in interfacePolicer.Builder
- Parameters:
dId
- a device id- Returns:
- this
-
fromApp
public Policer.Builder fromApp(ApplicationId appId)
Description copied from interface:Policer.Builder
Assigns the application that built this policer.Note: mandatory setter for this builder
- Specified by:
fromApp
in interfacePolicer.Builder
- Parameters:
appId
- an application id- Returns:
- this
-
withId
public Policer.Builder withId(PolicerId id)
Description copied from interface:Policer.Builder
Assigns the id to this policer.Note: mandatory setter for this builder
- Specified by:
withId
in interfacePolicer.Builder
- Parameters:
id
- an identifier- Returns:
- this
-
colorAware
public Policer.Builder colorAware(boolean isColorAware)
Description copied from interface:Policer.Builder
Sets this policer to be color aware. Defaults to false.- Specified by:
colorAware
in interfacePolicer.Builder
- Parameters:
isColorAware
- if it is color aware or not- Returns:
- this
-
withUnit
public Policer.Builder withUnit(Policer.Unit u)
Description copied from interface:Policer.Builder
Assigns the unit to use for this policer. Defaults to MB/s.- Specified by:
withUnit
in interfacePolicer.Builder
- Parameters:
u
- a unit- Returns:
- this
-
withPolicingResource
public Policer.Builder withPolicingResource(PolicingResource policingResource)
Description copied from interface:Policer.Builder
Assigns policer id and device id for this policer.- Specified by:
withPolicingResource
in interfacePolicer.Builder
- Parameters:
policingResource
- the policing resource- Returns:
- this
-
withTokenBuckets
public Policer.Builder withTokenBuckets(java.util.Collection<TokenBucket> tB)
Description copied from interface:Policer.Builder
Assigns token buckets for this policer.Note: at least one token bucket
- Specified by:
withTokenBuckets
in interfacePolicer.Builder
- Parameters:
tB
- the collection of token buckets- Returns:
- this
-
withDescription
public Policer.Builder withDescription(java.lang.String d)
Description copied from interface:Policer.Builder
Assigns description for this policer. Default is empty description.- Specified by:
withDescription
in interfacePolicer.Builder
- Parameters:
d
- the description- Returns:
- this
-
build
public DefaultPolicer build()
Description copied from interface:Policer.Builder
Builds the policer based on the specified parameters when possible.- Specified by:
build
in interfacePolicer.Builder
- Returns:
- a policer
-
-