Class PortStatsBuilder
java.lang.Object
org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.multipart.reply.port.stats.PortStatsBuilder
Class that builds
PortStats
instances. Overall design of the class is that of a
fluent interface, where method chaining is used.
In general, this class is supposed to be used like this template:
PortStats createPortStats(int fooXyzzy, int barBaz) {
return new PortStatsBuilder()
.setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
.setBar(new BarBuilder().setBaz(barBaz).build())
.build();
}
This pattern is supported by the immutable nature of PortStats, as instances can be freely passed around without worrying about synchronization issues.
As a side note: method chaining results in:
- very efficient Java bytecode, as the method invocation result, in this case the Builder reference, is
on the stack, so further method invocations just need to fill method arguments for the next method
invocation, which is terminated by
build()
, which is then returned from the method - better understanding by humans, as the scope of mutable state (the builder) is kept to a minimum and is very localized
- better optimization opportunities, as the object scope is minimized in terms of invocation (rather than method) stack, making escape analysis a lot easier. Given enough compiler (JIT/AOT) prowess, the cost of th builder object can be completely eliminated
- See Also:
-
Constructor Summary
ConstructorDescriptionConstruct an empty builder.PortStatsBuilder
(PortStats base) Construct a builder initialized with state from specifiedPortStats
. -
Method Summary
Modifier and TypeMethodDescriptionaddAugmentation
(org.opendaylight.yangtools.yang.binding.Augmentation<PortStats> augmentation) Add an augmentation to this builder's product.<E$$ extends org.opendaylight.yangtools.yang.binding.Augmentation<PortStats>>
E$$augmentation
(Class<E$$> augmentationType) Return the specified augmentation, if it is present in this builder.@NonNull PortStats
build()
A newPortStats
instance.org.opendaylight.yangtools.yang.common.Uint64
Return current value associated with the property corresponding toPortStats.getCollisions()
.org.opendaylight.yangtools.yang.common.Uint32
Return current value associated with the property corresponding toPortStats.getDurationNsec()
.org.opendaylight.yangtools.yang.common.Uint32
Return current value associated with the property corresponding toPortStats.getDurationSec()
.org.opendaylight.yangtools.yang.common.Uint32
Return current value associated with the property corresponding toPortStats.getPortNo()
.org.opendaylight.yangtools.yang.common.Uint64
Return current value associated with the property corresponding toPortStats.getRxBytes()
.org.opendaylight.yangtools.yang.common.Uint64
Return current value associated with the property corresponding toPortStats.getRxCrcErr()
.org.opendaylight.yangtools.yang.common.Uint64
Return current value associated with the property corresponding toPortStats.getRxDropped()
.org.opendaylight.yangtools.yang.common.Uint64
Return current value associated with the property corresponding toPortStats.getRxErrors()
.org.opendaylight.yangtools.yang.common.Uint64
Return current value associated with the property corresponding toPortStats.getRxFrameErr()
.org.opendaylight.yangtools.yang.common.Uint64
Return current value associated with the property corresponding toPortStats.getRxOverErr()
.org.opendaylight.yangtools.yang.common.Uint64
Return current value associated with the property corresponding toPortStats.getRxPackets()
.org.opendaylight.yangtools.yang.common.Uint64
Return current value associated with the property corresponding toPortStats.getTxBytes()
.org.opendaylight.yangtools.yang.common.Uint64
Return current value associated with the property corresponding toPortStats.getTxDropped()
.org.opendaylight.yangtools.yang.common.Uint64
Return current value associated with the property corresponding toPortStats.getTxErrors()
.org.opendaylight.yangtools.yang.common.Uint64
Return current value associated with the property corresponding toPortStats.getTxPackets()
.removeAugmentation
(Class<? extends org.opendaylight.yangtools.yang.binding.Augmentation<PortStats>> augmentationType) Remove an augmentation from this builder's product.setCollisions
(org.opendaylight.yangtools.yang.common.Uint64 value) Set the property corresponding toPortStats.getCollisions()
to the specified value.setDurationNsec
(org.opendaylight.yangtools.yang.common.Uint32 value) Set the property corresponding toPortStats.getDurationNsec()
to the specified value.setDurationSec
(org.opendaylight.yangtools.yang.common.Uint32 value) Set the property corresponding toPortStats.getDurationSec()
to the specified value.setPortNo
(org.opendaylight.yangtools.yang.common.Uint32 value) Set the property corresponding toPortStats.getPortNo()
to the specified value.setRxBytes
(org.opendaylight.yangtools.yang.common.Uint64 value) Set the property corresponding toPortStats.getRxBytes()
to the specified value.setRxCrcErr
(org.opendaylight.yangtools.yang.common.Uint64 value) Set the property corresponding toPortStats.getRxCrcErr()
to the specified value.setRxDropped
(org.opendaylight.yangtools.yang.common.Uint64 value) Set the property corresponding toPortStats.getRxDropped()
to the specified value.setRxErrors
(org.opendaylight.yangtools.yang.common.Uint64 value) Set the property corresponding toPortStats.getRxErrors()
to the specified value.setRxFrameErr
(org.opendaylight.yangtools.yang.common.Uint64 value) Set the property corresponding toPortStats.getRxFrameErr()
to the specified value.setRxOverErr
(org.opendaylight.yangtools.yang.common.Uint64 value) Set the property corresponding toPortStats.getRxOverErr()
to the specified value.setRxPackets
(org.opendaylight.yangtools.yang.common.Uint64 value) Set the property corresponding toPortStats.getRxPackets()
to the specified value.setTxBytes
(org.opendaylight.yangtools.yang.common.Uint64 value) Set the property corresponding toPortStats.getTxBytes()
to the specified value.setTxDropped
(org.opendaylight.yangtools.yang.common.Uint64 value) Set the property corresponding toPortStats.getTxDropped()
to the specified value.setTxErrors
(org.opendaylight.yangtools.yang.common.Uint64 value) Set the property corresponding toPortStats.getTxErrors()
to the specified value.setTxPackets
(org.opendaylight.yangtools.yang.common.Uint64 value) Set the property corresponding toPortStats.getTxPackets()
to the specified value.
-
Constructor Details
-
PortStatsBuilder
public PortStatsBuilder()Construct an empty builder. -
PortStatsBuilder
Construct a builder initialized with state from specifiedPortStats
.- Parameters:
base
- PortStats from which the builder should be initialized
-
-
Method Details
-
getCollisions
public org.opendaylight.yangtools.yang.common.Uint64 getCollisions()Return current value associated with the property corresponding toPortStats.getCollisions()
.- Returns:
- current value
-
getDurationNsec
public org.opendaylight.yangtools.yang.common.Uint32 getDurationNsec()Return current value associated with the property corresponding toPortStats.getDurationNsec()
.- Returns:
- current value
-
getDurationSec
public org.opendaylight.yangtools.yang.common.Uint32 getDurationSec()Return current value associated with the property corresponding toPortStats.getDurationSec()
.- Returns:
- current value
-
getPortNo
public org.opendaylight.yangtools.yang.common.Uint32 getPortNo()Return current value associated with the property corresponding toPortStats.getPortNo()
.- Returns:
- current value
-
getRxBytes
public org.opendaylight.yangtools.yang.common.Uint64 getRxBytes()Return current value associated with the property corresponding toPortStats.getRxBytes()
.- Returns:
- current value
-
getRxCrcErr
public org.opendaylight.yangtools.yang.common.Uint64 getRxCrcErr()Return current value associated with the property corresponding toPortStats.getRxCrcErr()
.- Returns:
- current value
-
getRxDropped
public org.opendaylight.yangtools.yang.common.Uint64 getRxDropped()Return current value associated with the property corresponding toPortStats.getRxDropped()
.- Returns:
- current value
-
getRxErrors
public org.opendaylight.yangtools.yang.common.Uint64 getRxErrors()Return current value associated with the property corresponding toPortStats.getRxErrors()
.- Returns:
- current value
-
getRxFrameErr
public org.opendaylight.yangtools.yang.common.Uint64 getRxFrameErr()Return current value associated with the property corresponding toPortStats.getRxFrameErr()
.- Returns:
- current value
-
getRxOverErr
public org.opendaylight.yangtools.yang.common.Uint64 getRxOverErr()Return current value associated with the property corresponding toPortStats.getRxOverErr()
.- Returns:
- current value
-
getRxPackets
public org.opendaylight.yangtools.yang.common.Uint64 getRxPackets()Return current value associated with the property corresponding toPortStats.getRxPackets()
.- Returns:
- current value
-
getTxBytes
public org.opendaylight.yangtools.yang.common.Uint64 getTxBytes()Return current value associated with the property corresponding toPortStats.getTxBytes()
.- Returns:
- current value
-
getTxDropped
public org.opendaylight.yangtools.yang.common.Uint64 getTxDropped()Return current value associated with the property corresponding toPortStats.getTxDropped()
.- Returns:
- current value
-
getTxErrors
public org.opendaylight.yangtools.yang.common.Uint64 getTxErrors()Return current value associated with the property corresponding toPortStats.getTxErrors()
.- Returns:
- current value
-
getTxPackets
public org.opendaylight.yangtools.yang.common.Uint64 getTxPackets()Return current value associated with the property corresponding toPortStats.getTxPackets()
.- Returns:
- current value
-
augmentation
public <E$$ extends org.opendaylight.yangtools.yang.binding.Augmentation<PortStats>> E$$ augmentation(Class<E$$> augmentationType) Return the specified augmentation, if it is present in this builder.- Type Parameters:
E$$
- augmentation type- Parameters:
augmentationType
- augmentation type class- Returns:
- Augmentation object from this builder, or
null
if not present - Throws:
NullPointerException
- ifaugmentType
isnull
-
setCollisions
Set the property corresponding toPortStats.getCollisions()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setDurationNsec
Set the property corresponding toPortStats.getDurationNsec()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setDurationSec
Set the property corresponding toPortStats.getDurationSec()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setPortNo
Set the property corresponding toPortStats.getPortNo()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setRxBytes
Set the property corresponding toPortStats.getRxBytes()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setRxCrcErr
Set the property corresponding toPortStats.getRxCrcErr()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setRxDropped
Set the property corresponding toPortStats.getRxDropped()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setRxErrors
Set the property corresponding toPortStats.getRxErrors()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setRxFrameErr
Set the property corresponding toPortStats.getRxFrameErr()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setRxOverErr
Set the property corresponding toPortStats.getRxOverErr()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setRxPackets
Set the property corresponding toPortStats.getRxPackets()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setTxBytes
Set the property corresponding toPortStats.getTxBytes()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setTxDropped
Set the property corresponding toPortStats.getTxDropped()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setTxErrors
Set the property corresponding toPortStats.getTxErrors()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
setTxPackets
Set the property corresponding toPortStats.getTxPackets()
to the specified value.- Parameters:
value
- desired value- Returns:
- this builder
-
addAugmentation
public PortStatsBuilder addAugmentation(org.opendaylight.yangtools.yang.binding.Augmentation<PortStats> augmentation) Add an augmentation to this builder's product.- Parameters:
augmentation
- augmentation to be added- Returns:
- this builder
- Throws:
NullPointerException
- ifaugmentation
is null
-
removeAugmentation
public PortStatsBuilder removeAugmentation(Class<? extends org.opendaylight.yangtools.yang.binding.Augmentation<PortStats>> augmentationType) Remove an augmentation from this builder's product. If this builder does not track such an augmentation type, this method does nothing.- Parameters:
augmentationType
- augmentation type to be removed- Returns:
- this builder
-
build
A newPortStats
instance.- Returns:
- A new
PortStats
instance.
-