<artifactId>openflowjava-extension-eric</artifactId>
<packaging>bundle</packaging>
- <properties>
- <!-- FIXME: Remove this -->
- <odlparent.modernizer.enforce>false</odlparent.modernizer.enforce>
- </properties>
-
<dependencies>
<dependency>
<groupId>${project.groupId}.openflowjava</groupId>
*/
package org.opendaylight.openflowjava.eric;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import org.opendaylight.openflowjava.eric.api.EricExtensionCodecRegistrator;
import org.opendaylight.openflowjava.eric.codec.match.Icmpv6NDOptionsTypeCodec;
import org.opendaylight.openflowjava.eric.codec.match.Icmpv6NDReservedCodec;
public class EricExtensionsRegistrator implements AutoCloseable {
private final EricExtensionCodecRegistrator registrator;
- public EricExtensionsRegistrator(EricExtensionCodecRegistrator registrator) {
- this.registrator = Preconditions.checkNotNull(registrator);
+ public EricExtensionsRegistrator(final EricExtensionCodecRegistrator registrator) {
+ this.registrator = requireNonNull(registrator);
registrator.registerMatchEntrySerializer(Icmpv6NDReservedCodec.SERIALIZER_KEY,
Icmpv6NDReservedCodec.INSTANCE);
registrator.registerMatchEntrySerializer(Icmpv6NDOptionsTypeCodec.SERIALIZER_KEY,
*/
package org.opendaylight.openflowjava.eric.codec.match;
-import com.google.common.primitives.Ints;
-
/**
* Eric header.
*/
private final int length;
public EricHeader(final long header) {
- this.headerAsLong = header;
- this.oxmClass = Ints.checkedCast(extractSub(header, 16, 16));
- this.ericField = Ints.checkedCast(extractSub(header, 7, 9));
- this.hasMask = extractSub(header, 1, 8) == 1;
- this.length = Ints.checkedCast(extractSub(header, 8, 0));
+ headerAsLong = header;
+ oxmClass = Math.toIntExact(extractSub(header, 16, 16));
+ ericField = Math.toIntExact(extractSub(header, 7, 9));
+ hasMask = extractSub(header, 1, 8) == 1;
+ length = Math.toIntExact(extractSub(header, 8, 0));
}
public EricHeader(final int oxmClass, final int ericField, final boolean hasMask, final int length) {
this.ericField = ericField;
this.hasMask = hasMask;
this.length = length;
- this.headerAsLong = (long) oxmClass << 16 | ericField << 9 | (hasMask ? 1 : 0) << 8 | length;
+ headerAsLong = (long) oxmClass << 16 | ericField << 9 | (hasMask ? 1 : 0) << 8 | length;
}
private static long extractSub(final long value, final int nrBits, final int offset) {