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

@Generated("mdsal-binding-generator") public class PortStatsBuilder extends Object
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 Details

    • PortStatsBuilder

      public PortStatsBuilder()
      Construct an empty builder.
    • PortStatsBuilder

      public PortStatsBuilder(PortStats base)
      Construct a builder initialized with state from specified PortStats.
      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 to PortStats.getCollisions().
      Returns:
      current value
    • getDurationNsec

      public org.opendaylight.yangtools.yang.common.Uint32 getDurationNsec()
      Return current value associated with the property corresponding to PortStats.getDurationNsec().
      Returns:
      current value
    • getDurationSec

      public org.opendaylight.yangtools.yang.common.Uint32 getDurationSec()
      Return current value associated with the property corresponding to PortStats.getDurationSec().
      Returns:
      current value
    • getPortNo

      public org.opendaylight.yangtools.yang.common.Uint32 getPortNo()
      Return current value associated with the property corresponding to PortStats.getPortNo().
      Returns:
      current value
    • getRxBytes

      public org.opendaylight.yangtools.yang.common.Uint64 getRxBytes()
      Return current value associated with the property corresponding to PortStats.getRxBytes().
      Returns:
      current value
    • getRxCrcErr

      public org.opendaylight.yangtools.yang.common.Uint64 getRxCrcErr()
      Return current value associated with the property corresponding to PortStats.getRxCrcErr().
      Returns:
      current value
    • getRxDropped

      public org.opendaylight.yangtools.yang.common.Uint64 getRxDropped()
      Return current value associated with the property corresponding to PortStats.getRxDropped().
      Returns:
      current value
    • getRxErrors

      public org.opendaylight.yangtools.yang.common.Uint64 getRxErrors()
      Return current value associated with the property corresponding to PortStats.getRxErrors().
      Returns:
      current value
    • getRxFrameErr

      public org.opendaylight.yangtools.yang.common.Uint64 getRxFrameErr()
      Return current value associated with the property corresponding to PortStats.getRxFrameErr().
      Returns:
      current value
    • getRxOverErr

      public org.opendaylight.yangtools.yang.common.Uint64 getRxOverErr()
      Return current value associated with the property corresponding to PortStats.getRxOverErr().
      Returns:
      current value
    • getRxPackets

      public org.opendaylight.yangtools.yang.common.Uint64 getRxPackets()
      Return current value associated with the property corresponding to PortStats.getRxPackets().
      Returns:
      current value
    • getTxBytes

      public org.opendaylight.yangtools.yang.common.Uint64 getTxBytes()
      Return current value associated with the property corresponding to PortStats.getTxBytes().
      Returns:
      current value
    • getTxDropped

      public org.opendaylight.yangtools.yang.common.Uint64 getTxDropped()
      Return current value associated with the property corresponding to PortStats.getTxDropped().
      Returns:
      current value
    • getTxErrors

      public org.opendaylight.yangtools.yang.common.Uint64 getTxErrors()
      Return current value associated with the property corresponding to PortStats.getTxErrors().
      Returns:
      current value
    • getTxPackets

      public org.opendaylight.yangtools.yang.common.Uint64 getTxPackets()
      Return current value associated with the property corresponding to PortStats.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 - if augmentType is null
    • setCollisions

      public PortStatsBuilder setCollisions(org.opendaylight.yangtools.yang.common.Uint64 value)
      Set the property corresponding to PortStats.getCollisions() to the specified value.
      Parameters:
      value - desired value
      Returns:
      this builder
    • setDurationNsec

      public PortStatsBuilder setDurationNsec(org.opendaylight.yangtools.yang.common.Uint32 value)
      Set the property corresponding to PortStats.getDurationNsec() to the specified value.
      Parameters:
      value - desired value
      Returns:
      this builder
    • setDurationSec

      public PortStatsBuilder setDurationSec(org.opendaylight.yangtools.yang.common.Uint32 value)
      Set the property corresponding to PortStats.getDurationSec() to the specified value.
      Parameters:
      value - desired value
      Returns:
      this builder
    • setPortNo

      public PortStatsBuilder setPortNo(org.opendaylight.yangtools.yang.common.Uint32 value)
      Set the property corresponding to PortStats.getPortNo() to the specified value.
      Parameters:
      value - desired value
      Returns:
      this builder
    • setRxBytes

      public PortStatsBuilder setRxBytes(org.opendaylight.yangtools.yang.common.Uint64 value)
      Set the property corresponding to PortStats.getRxBytes() to the specified value.
      Parameters:
      value - desired value
      Returns:
      this builder
    • setRxCrcErr

      public PortStatsBuilder setRxCrcErr(org.opendaylight.yangtools.yang.common.Uint64 value)
      Set the property corresponding to PortStats.getRxCrcErr() to the specified value.
      Parameters:
      value - desired value
      Returns:
      this builder
    • setRxDropped

      public PortStatsBuilder setRxDropped(org.opendaylight.yangtools.yang.common.Uint64 value)
      Set the property corresponding to PortStats.getRxDropped() to the specified value.
      Parameters:
      value - desired value
      Returns:
      this builder
    • setRxErrors

      public PortStatsBuilder setRxErrors(org.opendaylight.yangtools.yang.common.Uint64 value)
      Set the property corresponding to PortStats.getRxErrors() to the specified value.
      Parameters:
      value - desired value
      Returns:
      this builder
    • setRxFrameErr

      public PortStatsBuilder setRxFrameErr(org.opendaylight.yangtools.yang.common.Uint64 value)
      Set the property corresponding to PortStats.getRxFrameErr() to the specified value.
      Parameters:
      value - desired value
      Returns:
      this builder
    • setRxOverErr

      public PortStatsBuilder setRxOverErr(org.opendaylight.yangtools.yang.common.Uint64 value)
      Set the property corresponding to PortStats.getRxOverErr() to the specified value.
      Parameters:
      value - desired value
      Returns:
      this builder
    • setRxPackets

      public PortStatsBuilder setRxPackets(org.opendaylight.yangtools.yang.common.Uint64 value)
      Set the property corresponding to PortStats.getRxPackets() to the specified value.
      Parameters:
      value - desired value
      Returns:
      this builder
    • setTxBytes

      public PortStatsBuilder setTxBytes(org.opendaylight.yangtools.yang.common.Uint64 value)
      Set the property corresponding to PortStats.getTxBytes() to the specified value.
      Parameters:
      value - desired value
      Returns:
      this builder
    • setTxDropped

      public PortStatsBuilder setTxDropped(org.opendaylight.yangtools.yang.common.Uint64 value)
      Set the property corresponding to PortStats.getTxDropped() to the specified value.
      Parameters:
      value - desired value
      Returns:
      this builder
    • setTxErrors

      public PortStatsBuilder setTxErrors(org.opendaylight.yangtools.yang.common.Uint64 value)
      Set the property corresponding to PortStats.getTxErrors() to the specified value.
      Parameters:
      value - desired value
      Returns:
      this builder
    • setTxPackets

      public PortStatsBuilder setTxPackets(org.opendaylight.yangtools.yang.common.Uint64 value)
      Set the property corresponding to PortStats.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 - if augmentation 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

      public @NonNull PortStats build()
      A new PortStats instance.
      Returns:
      A new PortStats instance.