Package org.opendaylight.yang.gen.v1.http.openconfig.net.yang.interfaces.rev210406._interface.counters.state
Class CountersBuilder
java.lang.Object
org.opendaylight.yang.gen.v1.http.openconfig.net.yang.interfaces.rev210406._interface.counters.state.CountersBuilder
Class that builds
Counters 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:
Counters createCounters(int fooXyzzy, int barBaz) {
return new CountersBuilder()
.setFoo(new FooBuilder().setXyzzy(fooXyzzy).build())
.setBar(new BarBuilder().setBaz(barBaz).build())
.build();
}
This pattern is supported by the immutable nature of Counters, 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
ConstructorsConstructorDescriptionConstruct an empty builder.CountersBuilder(Counters base) Construct a builder initialized with state from specifiedCounters. -
Method Summary
Modifier and TypeMethodDescriptionaddAugmentation(org.opendaylight.yangtools.yang.binding.Augmentation<Counters> augmentation) Add an augmentation to this builder's product.<E$$ extends org.opendaylight.yangtools.yang.binding.Augmentation<Counters>>
E$$augmentation(Class<E$$> augmentationType) Return the specified augmentation, if it is present in this builder.@NonNull Countersbuild()A newCountersinstance.static @NonNull Countersempty()Get empty instance of Counters.Return current value associated with the property corresponding toCounters.getCarrierTransitions().Return current value associated with the property corresponding toCounters.getInBroadcastPkts().Return current value associated with the property corresponding toCounters.getInDiscards().Return current value associated with the property corresponding toCounters.getInErrors().Return current value associated with the property corresponding toCounters.getInFcsErrors().Return current value associated with the property corresponding toCounters.getInMulticastPkts().Return current value associated with the property corresponding toCounters.getInOctets().Return current value associated with the property corresponding toCounters.getInPkts().Return current value associated with the property corresponding toCounters.getInUnicastPkts().Return current value associated with the property corresponding toCounters.getInUnknownProtos().Return current value associated with the property corresponding toCounters.getLastClear().Return current value associated with the property corresponding toCounters.getOutBroadcastPkts().Return current value associated with the property corresponding toCounters.getOutDiscards().Return current value associated with the property corresponding toCounters.getOutErrors().Return current value associated with the property corresponding toCounters.getOutMulticastPkts().Return current value associated with the property corresponding toCounters.getOutOctets().Return current value associated with the property corresponding toCounters.getOutPkts().Return current value associated with the property corresponding toCounters.getOutUnicastPkts().removeAugmentation(Class<? extends org.opendaylight.yangtools.yang.binding.Augmentation<Counters>> augmentationType) Remove an augmentation from this builder's product.setCarrierTransitions(Counter64 value) Set the property corresponding toCounters.getCarrierTransitions()to the specified value.setInBroadcastPkts(Counter64 value) Set the property corresponding toCounters.getInBroadcastPkts()to the specified value.setInDiscards(Counter64 value) Set the property corresponding toCounters.getInDiscards()to the specified value.setInErrors(Counter64 value) Set the property corresponding toCounters.getInErrors()to the specified value.setInFcsErrors(Counter64 value) Set the property corresponding toCounters.getInFcsErrors()to the specified value.setInMulticastPkts(Counter64 value) Set the property corresponding toCounters.getInMulticastPkts()to the specified value.setInOctets(Counter64 value) Set the property corresponding toCounters.getInOctets()to the specified value.Set the property corresponding toCounters.getInPkts()to the specified value.setInUnicastPkts(Counter64 value) Set the property corresponding toCounters.getInUnicastPkts()to the specified value.setInUnknownProtos(Counter64 value) Set the property corresponding toCounters.getInUnknownProtos()to the specified value.setLastClear(Timeticks64 value) Set the property corresponding toCounters.getLastClear()to the specified value.setOutBroadcastPkts(Counter64 value) Set the property corresponding toCounters.getOutBroadcastPkts()to the specified value.setOutDiscards(Counter64 value) Set the property corresponding toCounters.getOutDiscards()to the specified value.setOutErrors(Counter64 value) Set the property corresponding toCounters.getOutErrors()to the specified value.setOutMulticastPkts(Counter64 value) Set the property corresponding toCounters.getOutMulticastPkts()to the specified value.setOutOctets(Counter64 value) Set the property corresponding toCounters.getOutOctets()to the specified value.setOutPkts(Counter64 value) Set the property corresponding toCounters.getOutPkts()to the specified value.setOutUnicastPkts(Counter64 value) Set the property corresponding toCounters.getOutUnicastPkts()to the specified value.
-
Constructor Details
-
CountersBuilder
public CountersBuilder()Construct an empty builder. -
CountersBuilder
Construct a builder initialized with state from specifiedCounters.- Parameters:
base- Counters from which the builder should be initialized
-
-
Method Details
-
empty
Get empty instance of Counters.- Returns:
- An empty
Counters
-
getCarrierTransitions
Return current value associated with the property corresponding toCounters.getCarrierTransitions().- Returns:
- current value
-
getInBroadcastPkts
Return current value associated with the property corresponding toCounters.getInBroadcastPkts().- Returns:
- current value
-
getInDiscards
Return current value associated with the property corresponding toCounters.getInDiscards().- Returns:
- current value
-
getInErrors
Return current value associated with the property corresponding toCounters.getInErrors().- Returns:
- current value
-
getInFcsErrors
Return current value associated with the property corresponding toCounters.getInFcsErrors().- Returns:
- current value
-
getInMulticastPkts
Return current value associated with the property corresponding toCounters.getInMulticastPkts().- Returns:
- current value
-
getInOctets
Return current value associated with the property corresponding toCounters.getInOctets().- Returns:
- current value
-
getInPkts
Return current value associated with the property corresponding toCounters.getInPkts().- Returns:
- current value
-
getInUnicastPkts
Return current value associated with the property corresponding toCounters.getInUnicastPkts().- Returns:
- current value
-
getInUnknownProtos
Return current value associated with the property corresponding toCounters.getInUnknownProtos().- Returns:
- current value
-
getLastClear
Return current value associated with the property corresponding toCounters.getLastClear().- Returns:
- current value
-
getOutBroadcastPkts
Return current value associated with the property corresponding toCounters.getOutBroadcastPkts().- Returns:
- current value
-
getOutDiscards
Return current value associated with the property corresponding toCounters.getOutDiscards().- Returns:
- current value
-
getOutErrors
Return current value associated with the property corresponding toCounters.getOutErrors().- Returns:
- current value
-
getOutMulticastPkts
Return current value associated with the property corresponding toCounters.getOutMulticastPkts().- Returns:
- current value
-
getOutOctets
Return current value associated with the property corresponding toCounters.getOutOctets().- Returns:
- current value
-
getOutPkts
Return current value associated with the property corresponding toCounters.getOutPkts().- Returns:
- current value
-
getOutUnicastPkts
Return current value associated with the property corresponding toCounters.getOutUnicastPkts().- Returns:
- current value
-
augmentation
public <E$$ extends org.opendaylight.yangtools.yang.binding.Augmentation<Counters>> 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
nullif not present - Throws:
NullPointerException- ifaugmentTypeisnull
-
setCarrierTransitions
Set the property corresponding toCounters.getCarrierTransitions()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setInBroadcastPkts
Set the property corresponding toCounters.getInBroadcastPkts()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setInDiscards
Set the property corresponding toCounters.getInDiscards()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setInErrors
Set the property corresponding toCounters.getInErrors()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setInFcsErrors
Set the property corresponding toCounters.getInFcsErrors()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setInMulticastPkts
Set the property corresponding toCounters.getInMulticastPkts()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setInOctets
Set the property corresponding toCounters.getInOctets()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setInPkts
Set the property corresponding toCounters.getInPkts()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setInUnicastPkts
Set the property corresponding toCounters.getInUnicastPkts()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setInUnknownProtos
Set the property corresponding toCounters.getInUnknownProtos()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setLastClear
Set the property corresponding toCounters.getLastClear()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setOutBroadcastPkts
Set the property corresponding toCounters.getOutBroadcastPkts()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setOutDiscards
Set the property corresponding toCounters.getOutDiscards()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setOutErrors
Set the property corresponding toCounters.getOutErrors()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setOutMulticastPkts
Set the property corresponding toCounters.getOutMulticastPkts()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setOutOctets
Set the property corresponding toCounters.getOutOctets()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setOutPkts
Set the property corresponding toCounters.getOutPkts()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
setOutUnicastPkts
Set the property corresponding toCounters.getOutUnicastPkts()to the specified value.- Parameters:
value- desired value- Returns:
- this builder
-
addAugmentation
public CountersBuilder addAugmentation(org.opendaylight.yangtools.yang.binding.Augmentation<Counters> augmentation) Add an augmentation to this builder's product.- Parameters:
augmentation- augmentation to be added- Returns:
- this builder
- Throws:
NullPointerException- ifaugmentationis null
-
removeAugmentation
public CountersBuilder removeAugmentation(Class<? extends org.opendaylight.yangtools.yang.binding.Augmentation<Counters>> 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 newCountersinstance.- Returns:
- A new
Countersinstance.
-