Fix checkstyle violations in openflow-protocol-impl - part 7 88/67388/2
authorTom Pantelis <tompantelis@gmail.com>
Sat, 20 Jan 2018 23:11:32 +0000 (18:11 -0500)
committerTom Pantelis <tompantelis@gmail.com>
Sat, 27 Jan 2018 02:29:56 +0000 (21:29 -0500)
Many violations - more to follow

Change-Id: I35f1ada078217cc89d03f2953829ac2274a53655
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
30 files changed:
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/ext/AbstractOxmExperimenterMatchEntrySerializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/ext/OnfOxmTcpFlagsSerializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/AbstractCodeKeyMaker.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/AbstractTypeKeyMaker.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/ActionConstants.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/ActionDeserializerRegistryHelper.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/ActionSerializerRegistryHelper.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/CodeKeyMaker.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/CodeKeyMakerFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/CommonMessageRegistryHelper.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/InstructionConstants.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/InstructionDeserializerRegistryHelper.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/InstructionSerializerRegistryHelper.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/ListDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/ListSerializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/MatchDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/MatchEntryDeserializerRegistryHelper.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/MatchEntrySerializerRegistryHelper.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/OF10MatchDeserializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/OF10MatchSerializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/OF13MatchSerializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/OpenflowUtils.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/SimpleDeserializerRegistryHelper.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/TypeKeyMaker.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/TypeKeyMakerFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/TypeToClassInitHelper.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/VersionAssignableFactory.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/statistics/Counter.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/statistics/CounterEventTypes.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/statistics/StatisticsCounters.java

index 4d82ad85413cb02a93796978391ec45fa0108d97..926a30b3b2147349eb39824a5281a2ed2f90fb7d 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.openflowjava.protocol.impl.serialization.match.ext;
 
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
-import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
 import org.opendaylight.openflowjava.protocol.impl.serialization.match.AbstractOxmMatchEntrySerializer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
@@ -52,7 +51,7 @@ public abstract class AbstractOxmExperimenterMatchEntrySerializer extends Abstra
     }
 
     /**
-     * @return Experimenter match entry ID
+     * Returns the Experimenter match entry ID.
      */
     protected abstract long getExperimenterId();
 }
index f244cc42ff756fbfd40566d7b0955cc25df40cfa..ad4da37b45d1594886a74ac87cdcf117cd2d1243 100644 (file)
@@ -32,7 +32,7 @@ public class OnfOxmTcpFlagsSerializer extends AbstractOxmExperimenterMatchEntryS
     }
 
     /**
-     * @return Experimenter match entry ID
+     * Returns the Experimenter match entry ID.
      */
     @Override
     protected long getExperimenterId() {
@@ -40,7 +40,7 @@ public class OnfOxmTcpFlagsSerializer extends AbstractOxmExperimenterMatchEntryS
     }
 
     /**
-     * @return numeric representation of oxm_field
+     * Returns the numeric representation of oxm_field.
      */
     @Override
     protected int getOxmFieldCode() {
@@ -48,7 +48,7 @@ public class OnfOxmTcpFlagsSerializer extends AbstractOxmExperimenterMatchEntryS
     }
 
     /**
-     * @return numeric representation of oxm_class
+     * Returns the numeric representation of oxm_class.
      */
     @Override
     protected int getOxmClassCode() {
@@ -56,7 +56,7 @@ public class OnfOxmTcpFlagsSerializer extends AbstractOxmExperimenterMatchEntryS
     }
 
     /**
-     * @return match entry value length (without mask length)
+     * Returns the match entry value length (without mask length).
      */
     @Override
     protected int getValueLength() {
index 7aff0aa7be04af5a705d00f158e8139b7188b5dd..0307668d12203a3486ac748162ee12500f4ba387 100644 (file)
@@ -8,13 +8,17 @@
 package org.opendaylight.openflowjava.protocol.impl.util;
 
 /**
+ * Base class for a CodeKeyMaker.
+ *
  * @author michal.polkorab
  */
 public abstract class AbstractCodeKeyMaker implements CodeKeyMaker {
 
-    private short version;
+    private final short version;
 
     /**
+     * Constractor.
+     *
      * @param version openflow wire version
      */
     public AbstractCodeKeyMaker(short version) {
@@ -23,10 +27,9 @@ public abstract class AbstractCodeKeyMaker implements CodeKeyMaker {
     }
 
     /**
-     * @return the version
+     * Returns the version.
      */
     public short getVersion() {
         return version;
     }
-
 }
index 70c7a1551b6f2ae80c702b1831c1cbe4c0fd92fc..8b4ef77fb8ef8615b661c6d46393ea4f75d42825 100644 (file)
@@ -10,14 +10,18 @@ package org.opendaylight.openflowjava.protocol.impl.util;
 
 
 /**
+ * Base class for a TypeKeyMaker.
+ *
  * @author michal.polkorab
  * @param <T> type the key maker is based on
  */
 public abstract class AbstractTypeKeyMaker<T> implements TypeKeyMaker<T> {
 
-    private short version;
+    private final short version;
 
     /**
+     * Constructor.
+     *
      * @param version openflow wire version
      */
     public AbstractTypeKeyMaker(short version) {
@@ -26,10 +30,9 @@ public abstract class AbstractTypeKeyMaker<T> implements TypeKeyMaker<T> {
     }
 
     /**
-     * @return the version
+     * Returns the version.
      */
     public short getVersion() {
         return version;
     }
-
 }
index 41791780813bca9bb29bf0efa9ee3a504775d676..c30858144b16a2a6dcda2186dabfc029783b3b0f 100644 (file)
 package org.opendaylight.openflowjava.protocol.impl.util;
 
 /**
- * @author michal.polkorab
+ * Action constants.
  *
+ * @author michal.polkorab
  */
-public final class ActionConstants {
-
-    /** Openflow v1.0 and v1.3 OFPAT_OUTPUT code */
-    public static final byte OUTPUT_CODE = 0;
-    /** Openflow v1.0 OFPAT_SET_VLAN_VID code */
-    public static final byte SET_VLAN_VID_CODE = 1;
-    /** Openflow v1.0 OFPAT_SET_VLAN_PCP code */
-    public static final byte SET_VLAN_PCP_CODE = 2;
-    /** Openflow v1.0 OFPAT_STRIP_VLAN code */
-    public static final byte STRIP_VLAN_CODE = 3;
-    /** Openflow v1.0 OFPAT_SET_DL_SRC code */
-    public static final byte SET_DL_SRC_CODE = 4;
-    /** Openflow v1.0 OFPAT_SET_DL_DST code */
-    public static final byte SET_DL_DST_CODE = 5;
-    /** Openflow v1.0 OFPAT_SET_NW_SRC code */
-    public static final byte SET_NW_SRC_CODE = 6;
-    /** Openflow v1.0 OFPAT_SET_NW_DST code */
-    public static final byte SET_NW_DST_CODE = 7;
-    /** Openflow v1.0 OFPAT_SET_NW_TOS code */
-    public static final byte SET_NW_TOS_CODE = 8;
-    /** Openflow v1.0 OFPAT_SET_TP_SRC code */
-    public static final byte SET_TP_SRC_CODE = 9;
-    /** Openflow v1.0 OFPAT_SET_TP_DST code */
-    public static final byte SET_TP_DST_CODE = 10;
-    /** Openflow v1.0 OFPAT_ENQUEUE code */
-    public static final byte ENQUEUE_CODE = 11;
-    /** Openflow v1.3 OFPAT_COPY_TTL_OUT code */
-    public static final byte COPY_TTL_OUT_CODE = 11;
-    /** Openflow v1.3 OFPAT_COPY_TTL_IN code */
-    public static final byte COPY_TTL_IN_CODE = 12;
-    /** Openflow v1.3 OFPAT_SET_MPLS_TTL code */
-    public static final byte SET_MPLS_TTL_CODE = 15;
-    /** Openflow v1.3 OFPAT_DEC_MPLS_TTL code */
-    public static final byte DEC_MPLS_TTL_CODE = 16;
-    /** Openflow v1.3 OFPAT_PUSH_VLAN code */
-    public static final byte PUSH_VLAN_CODE = 17;
-    /** Openflow v1.3 OFPAT_POP_VLAN code */
-    public static final byte POP_VLAN_CODE = 18;
-    /** Openflow v1.3 OFPAT_PUSH_MPLS code */
-    public static final byte PUSH_MPLS_CODE = 19;
-    /** Openflow v1.3 OFPAT_POP_MPLS code */
-    public static final byte POP_MPLS_CODE = 20;
-    /** Openflow v1.3 OFPAT_SET_QUEUE code */
-    public static final byte SET_QUEUE_CODE = 21;
-    /** Openflow v1.3 OFPAT_GROUP code */
-    public static final byte GROUP_CODE = 22;
-    /** Openflow v1.3 OFPAT_SET_NW_TTL code */
-    public static final byte SET_NW_TTL_CODE = 23;
-    /** Openflow v1.3 OFPAT_DEC_NW_TTL code */
-    public static final byte DEC_NW_TTL_CODE = 24;
-    /** Openflow v1.3 OFPAT_SET_FIELD code */
-    public static final int SET_FIELD_CODE = 25;
-    /** Openflow v1.3 OFPAT_PUSH_PBB code */
-    public static final byte PUSH_PBB_CODE = 26;
-    /** Openflow v1.3 OFPAT_POP_PBB code */
-    public static final byte POP_PBB_CODE = 27;
-
-    /** Padding in OFPAT_OUTPUT (OF v1.3) */
-    public static final byte OUTPUT_PADDING = 6;
-    /** Padding in OFPAT_SET_VLAN_VID (OF v1.3) */
-    public static final byte PADDING_IN_SET_VLAN_VID_ACTION = 2;
-    /** Padding in OFPAT_SET_VLAN_PCP (OF v1.3) */
-    public static final byte PADDING_IN_SET_VLAN_PCP_ACTION = 3;
-    /** Padding in OFPAT_SET_NW_TOS (OF v1.3) */
-    public static final byte PADDING_IN_SET_NW_TOS_ACTION = 3;
-    /** Padding in OFPAT_ENQUEUE (OF v1.3) */
-    public static final int PADDING_IN_ENQUEUE_ACTION = 6;
-    /** Padding in OFPAT_SET_MPLS_TTL (OF v1.3) */
-    public static final byte SET_MPLS_TTL_PADDING = 3;
-    /** Padding in OFPAT_SET_NW_TTL (OF v1.3) */
-    public static final byte SET_NW_TTL_PADDING = 3;
-    /** Padding in OFPAT_SET_DL_SRC and OFPAT_SET_DL_DST (OF v1.3) */
-    public static final byte PADDING_IN_DL_ADDRESS_ACTION = 6;
-    /** Padding in OFPAT_SET_TP_SRC and OFPAT_SET_TP_DST (OF v1.3) */
-    public static final byte PADDING_IN_TP_PORT_ACTION = 2;
-    /** Padding in action header (OF v1.3) */
-    public static final byte PADDING_IN_ACTION_HEADER = 4;
+public interface ActionConstants {
+
+    /** Openflow v1.0 and v1.3 OFPAT_OUTPUT code. */
+    byte OUTPUT_CODE = 0;
+
+    /** Openflow v1.0 OFPAT_SET_VLAN_VID code. */
+    byte SET_VLAN_VID_CODE = 1;
+
+    /** Openflow v1.0 OFPAT_SET_VLAN_PCP code. */
+    byte SET_VLAN_PCP_CODE = 2;
+
+    /** Openflow v1.0 OFPAT_STRIP_VLAN code. */
+    byte STRIP_VLAN_CODE = 3;
+
+    /** Openflow v1.0 OFPAT_SET_DL_SRC code. */
+    byte SET_DL_SRC_CODE = 4;
+
+    /** Openflow v1.0 OFPAT_SET_DL_DST code. */
+    byte SET_DL_DST_CODE = 5;
+
+    /** Openflow v1.0 OFPAT_SET_NW_SRC code. */
+    byte SET_NW_SRC_CODE = 6;
+
+    /** Openflow v1.0 OFPAT_SET_NW_DST code. */
+    byte SET_NW_DST_CODE = 7;
+
+    /** Openflow v1.0 OFPAT_SET_NW_TOS code. */
+    byte SET_NW_TOS_CODE = 8;
+
+    /** Openflow v1.0 OFPAT_SET_TP_SRC code. */
+    byte SET_TP_SRC_CODE = 9;
+
+    /** Openflow v1.0 OFPAT_SET_TP_DST code. */
+    byte SET_TP_DST_CODE = 10;
+
+    /** Openflow v1.0 OFPAT_ENQUEUE code. */
+    byte ENQUEUE_CODE = 11;
+
+    /** Openflow v1.3 OFPAT_COPY_TTL_OUT code. */
+    byte COPY_TTL_OUT_CODE = 11;
+
+    /** Openflow v1.3 OFPAT_COPY_TTL_IN code. */
+    byte COPY_TTL_IN_CODE = 12;
+
+    /** Openflow v1.3 OFPAT_SET_MPLS_TTL code. */
+    byte SET_MPLS_TTL_CODE = 15;
+
+    /** Openflow v1.3 OFPAT_DEC_MPLS_TTL code. */
+    byte DEC_MPLS_TTL_CODE = 16;
+
+    /** Openflow v1.3 OFPAT_PUSH_VLAN code. */
+    byte PUSH_VLAN_CODE = 17;
+
+    /** Openflow v1.3 OFPAT_POP_VLAN code. */
+    byte POP_VLAN_CODE = 18;
+
+    /** Openflow v1.3 OFPAT_PUSH_MPLS code. */
+    byte PUSH_MPLS_CODE = 19;
+
+    /** Openflow v1.3 OFPAT_POP_MPLS code. */
+    byte POP_MPLS_CODE = 20;
+
+    /** Openflow v1.3 OFPAT_SET_QUEUE code. */
+    byte SET_QUEUE_CODE = 21;
+
+    /** Openflow v1.3 OFPAT_GROUP code. */
+    byte GROUP_CODE = 22;
+
+    /** Openflow v1.3 OFPAT_SET_NW_TTL code. */
+    byte SET_NW_TTL_CODE = 23;
+
+    /** Openflow v1.3 OFPAT_DEC_NW_TTL code. */
+    byte DEC_NW_TTL_CODE = 24;
+
+    /** Openflow v1.3 OFPAT_SET_FIELD code. */
+    int SET_FIELD_CODE = 25;
+
+    /** Openflow v1.3 OFPAT_PUSH_PBB code. */
+    byte PUSH_PBB_CODE = 26;
+
+    /** Openflow v1.3 OFPAT_POP_PBB code. */
+    byte POP_PBB_CODE = 27;
+
+    /** Padding in OFPAT_OUTPUT (OF v1.3). */
+    byte OUTPUT_PADDING = 6;
+
+    /** Padding in OFPAT_SET_VLAN_VID (OF v1.3). */
+    byte PADDING_IN_SET_VLAN_VID_ACTION = 2;
+
+    /** Padding in OFPAT_SET_VLAN_PCP (OF v1.3). */
+    byte PADDING_IN_SET_VLAN_PCP_ACTION = 3;
+
+    /** Padding in OFPAT_SET_NW_TOS (OF v1.3). */
+    byte PADDING_IN_SET_NW_TOS_ACTION = 3;
+
+    /** Padding in OFPAT_ENQUEUE (OF v1.3). */
+    int PADDING_IN_ENQUEUE_ACTION = 6;
+
+    /** Padding in OFPAT_SET_MPLS_TTL (OF v1.3). */
+    byte SET_MPLS_TTL_PADDING = 3;
+
+    /** Padding in OFPAT_SET_NW_TTL (OF v1.3). */
+    byte SET_NW_TTL_PADDING = 3;
+
+    /** Padding in OFPAT_SET_DL_SRC and OFPAT_SET_DL_DST (OF v1.3). */
+    byte PADDING_IN_DL_ADDRESS_ACTION = 6;
+
+    /** Padding in OFPAT_SET_TP_SRC and OFPAT_SET_TP_DST (OF v1.3). */
+    byte PADDING_IN_TP_PORT_ACTION = 2;
+
+    /** Padding in action header (OF v1.3). */
+    byte PADDING_IN_ACTION_HEADER = 4;
+
     /** Padding in OFPAT_PUSH_VLAN, OFPAT_PUSH_MPLS, OFPAT_POP_MPLS
-     *  and OFPAT_PUSH_PBB (OF v1.3) */
-    public static final byte ETHERTYPE_ACTION_PADDING = 2;
+     *  and OFPAT_PUSH_PBB (OF v1.3). */
+    byte ETHERTYPE_ACTION_PADDING = 2;
+
+    /** Most common action length. */
+    byte GENERAL_ACTION_LENGTH = 8;
 
-    /** Most common action length */
-    public static final byte GENERAL_ACTION_LENGTH = 8;
     /** Action larger than GENERAL_ACTION_LENGTH - currently
-     *  only 16 bytes long actions for both OF v1.0 and v1.3*/
-    public static final byte LARGER_ACTION_LENGTH = 16;
-    /** Action header size */
-    public static final byte ACTION_IDS_LENGTH = 4;
-
-    private ActionConstants() {
-        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
-    }
+     *  only 16 bytes long actions for both OF v1.0 and v1.3. */
+    byte LARGER_ACTION_LENGTH = 16;
+
+    /** Action header size. */
+    byte ACTION_IDS_LENGTH = 4;
 }
index 49c1b6fc14b70e08c54e0643cb900c8ecb9d2851..7afbf79a972f56049e9203a6ed1634829b5aed41 100644 (file)
@@ -12,15 +12,18 @@ import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralDeseria
 import org.opendaylight.openflowjava.protocol.api.keys.ActionDeserializerKey;
 
 /**
- * @author michal.polkorab
+ * Helper for registering deserializers.
  *
+ * @author michal.polkorab
  */
 public class ActionDeserializerRegistryHelper {
 
-    private short version;
-    private DeserializerRegistry registry;
+    private final short version;
+    private final DeserializerRegistry registry;
 
     /**
+     * Constructor.
+     *
      * @param version wire protocol version
      * @param deserializerRegistry registry to be filled with message deserializers
      */
@@ -30,6 +33,8 @@ public class ActionDeserializerRegistryHelper {
     }
 
     /**
+     * Registers a deserializer.
+     *
      * @param code code / value to distinguish between deserializers
      * @param deserializer deserializer instance
      */
index b622dd17edacf005cda3059931874a82d58f1349..558bb958729aaa396daaf8d432e476eb2dd77231 100644 (file)
@@ -13,16 +13,20 @@ import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
 
 /**
+ * Helper for registering serializers.
+ *
  * @author michal.polkorab
  */
 public class ActionSerializerRegistryHelper {
 
-    private short version;
-    private SerializerRegistry serializerRegistry;
+    private final short version;
+    private final SerializerRegistry serializerRegistry;
 
     /**
+     * Constructor.
+     *
      * @param version Openflow wire version
-     * @param serializerRegistry
+     * @param serializerRegistry registry to be filled with message serializers
      */
     public ActionSerializerRegistryHelper(short version, SerializerRegistry serializerRegistry) {
         this.version = version;
@@ -30,9 +34,10 @@ public class ActionSerializerRegistryHelper {
     }
 
     /**
-     * Registers given serializer
-     * @param actionType
-     * @param serializer
+     * Registers given serializer.
+     *
+     * @param actionType action type
+     * @param serializer serializer instance
      */
     public <T extends ActionChoice> void registerSerializer(Class<T> actionType,
             OFGeneralSerializer serializer) {
index 865db78035bf30942ba9a48b361bcaba4183b064..adb7f09fc1f58011b881caea34dc242f222fbe2d 100644 (file)
@@ -8,19 +8,21 @@
 
 package org.opendaylight.openflowjava.protocol.impl.util;
 
-import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
-
 import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
 
 /**
+ * Interface for making code keys.
+ *
  * @author michal.polkorab
  */
 public interface CodeKeyMaker {
 
     /**
+     * Makes a code key.
+     *
      * @param input buffer that will be the needed data gathered from
      * @return key for deserializer lookup
      */
-    abstract MessageCodeKey make(ByteBuf input);
-
+    MessageCodeKey make(ByteBuf input);
 }
index ba692c8f81a629692b08d43e522c686e258a2cf8..4bad43db8d4f1e7b5fed30f853de8440c4ab4fdd 100644 (file)
@@ -9,7 +9,6 @@
 package org.opendaylight.openflowjava.protocol.impl.util;
 
 import io.netty.buffer.ByteBuf;
-
 import org.opendaylight.openflowjava.protocol.api.keys.ActionDeserializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterActionDeserializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterInstructionDeserializerKey;
@@ -19,18 +18,16 @@ import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
 
 /**
- * @author michal.polkorab
+ * Factory for creating CodeKeyMaker instances.
  *
+ * @author michal.polkorab
  */
-public abstract class CodeKeyMakerFactory {
+public final class CodeKeyMakerFactory {
 
     private CodeKeyMakerFactory() {
         //not called
     }
-    /**
-     * @param version
-     * @return
-     */
+
     public static CodeKeyMaker createMatchEntriesKeyMaker(short version) {
         return new AbstractCodeKeyMaker(version) {
             @Override
@@ -52,10 +49,6 @@ public abstract class CodeKeyMakerFactory {
         };
     }
 
-    /**
-     * @param version
-     * @return
-     */
     public static CodeKeyMaker createActionsKeyMaker(short version) {
         return new AbstractCodeKeyMaker(version) {
             @Override
@@ -72,10 +65,6 @@ public abstract class CodeKeyMakerFactory {
         };
     }
 
-    /**
-     * @param version
-     * @return
-     */
     public static CodeKeyMaker createInstructionsKeyMaker(short version) {
         return new AbstractCodeKeyMaker(version) {
             @Override
index 15bc5971f8cb9142eb426c6f5bf977f4abf43db7..2f481a64411a82913d3a4c04ffd46f7708abb3c9 100644 (file)
@@ -10,18 +10,20 @@ package org.opendaylight.openflowjava.protocol.impl.util;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralSerializer;
 import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
 import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
-import org.opendaylight.openflowjava.util.ExperimenterSerializerKeyFactory;
 
 /**
  * Helper class for serializer registration.
+ *
  * @author michal.polkorab
  */
 public class CommonMessageRegistryHelper {
 
-    private short version;
-    private SerializerRegistry serializerRegistry;
+    private final short version;
+    private final SerializerRegistry serializerRegistry;
 
     /**
+     * Constructor.
+     *
      * @param version wire protocol version
      * @param serializerRegistry registry to be filled with message serializers
      */
@@ -38,5 +40,4 @@ public class CommonMessageRegistryHelper {
     public void registerSerializer(Class<?> msgType, OFGeneralSerializer serializer) {
         serializerRegistry.registerSerializer(new MessageTypeKey<>(version, msgType), serializer);
     }
-
 }
index 7d9479a12111f030ff89df246edccca088857b7c..c75904995b948ef93f5cadf1f1627ddeb2027462 100644 (file)
@@ -9,40 +9,45 @@
 package org.opendaylight.openflowjava.protocol.impl.util;
 
 /**
- * @author michal.polkorab
+ * Instruction constants.
  *
+ * @author michal.polkorab
  */
-public final class InstructionConstants {
-
-    /** Openflow v1.3 OFPIT_GOTO_TABLE code */
-    public static final byte GOTO_TABLE_TYPE = 1;
-    /** Openflow v1.3 OFPIT_WRITE_METADATA code */
-    public static final byte WRITE_METADATA_TYPE = 2;
-    /** Openflow v1.3 OFPIT_WRITE_ACTIONS code */
-    public static final byte WRITE_ACTIONS_TYPE = 3;
-    /** Openflow v1.3 OFPIT_APPLY_ACTIONS code */
-    public static final byte APPLY_ACTIONS_TYPE = 4;
-    /** Openflow v1.3 OFPIT_CLEAR_ACTIONS code */
-    public static final byte CLEAR_ACTIONS_TYPE = 5;
-    /** Openflow v1.3 OFPIT_METER code */
-    public static final byte METER_TYPE = 6;
-
-    /** PADDING in OFPIT_GOTO_TABLE */
-    public static final byte PADDING_IN_GOTO_TABLE = 3;
-    /** PADDING in OFPIT_WRITE_METADATA */
-    public static final byte PADDING_IN_WRITE_METADATA = 4;
-    /** PADDING in OFPIT_WRITE_ACTIONS, OFPIT_APPLY_ACTIONS
-     *  and OFPIT_CLEAR_ACTIONS */
-    public static final byte PADDING_IN_ACTIONS_INSTRUCTION = 4;
-
-    /** Openflow v1.3 header length (padded) */
-    public static final byte STANDARD_INSTRUCTION_LENGTH = 8;
-    /** Openflow v1.3 OFPIT_WRITE_METADATA length */
-    public static final byte WRITE_METADATA_LENGTH = 24;
-    /** Openflow v1.3 header length (only type and length fields) */
-    public static final byte INSTRUCTION_IDS_LENGTH = 4;
-
-    private InstructionConstants() {
-        throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
-    }
+public interface InstructionConstants {
+
+    /** Openflow v1.3 OFPIT_GOTO_TABLE code. */
+    byte GOTO_TABLE_TYPE = 1;
+
+    /** Openflow v1.3 OFPIT_WRITE_METADATA code. */
+    byte WRITE_METADATA_TYPE = 2;
+
+    /** Openflow v1.3 OFPIT_WRITE_ACTIONS code. */
+    byte WRITE_ACTIONS_TYPE = 3;
+
+    /** Openflow v1.3 OFPIT_APPLY_ACTIONS code. */
+    byte APPLY_ACTIONS_TYPE = 4;
+
+    /** Openflow v1.3 OFPIT_CLEAR_ACTIONS code. */
+    byte CLEAR_ACTIONS_TYPE = 5;
+
+    /** Openflow v1.3 OFPIT_METER code. */
+    byte METER_TYPE = 6;
+
+    /** PADDING in OFPIT_GOTO_TABLE. */
+    byte PADDING_IN_GOTO_TABLE = 3;
+
+    /** PADDING in OFPIT_WRITE_METADATA. */
+    byte PADDING_IN_WRITE_METADATA = 4;
+
+    /** PADDING in OFPIT_WRITE_ACTIONS, OFPIT_APPLY_ACTIONS and OFPIT_CLEAR_ACTIONS. */
+    byte PADDING_IN_ACTIONS_INSTRUCTION = 4;
+
+    /** Openflow v1.3 header length (padded). */
+    byte STANDARD_INSTRUCTION_LENGTH = 8;
+
+    /** Openflow v1.3 OFPIT_WRITE_METADATA length. */
+    byte WRITE_METADATA_LENGTH = 24;
+
+    /** Openflow v1.3 header length (only type and length fields). */
+    byte INSTRUCTION_IDS_LENGTH = 4;
 }
index 19149e109c94973281b5598feaac9eed42743216..36cf2c529f6980ff746fa91f24cdf58bd7e9a590 100644 (file)
@@ -12,15 +12,18 @@ import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralDeseria
 import org.opendaylight.openflowjava.protocol.api.keys.InstructionDeserializerKey;
 
 /**
- * @author michal.polkorab
+ * Helper class for registering instruction deserializers.
  *
+ * @author michal.polkorab
  */
 public class InstructionDeserializerRegistryHelper {
 
-    private short version;
-    private DeserializerRegistry registry;
+    private final short version;
+    private final DeserializerRegistry registry;
 
     /**
+     * Constructor.
+     *
      * @param version wire protocol version
      * @param deserializerRegistry registry to be filled with message deserializers
      */
@@ -30,6 +33,8 @@ public class InstructionDeserializerRegistryHelper {
     }
 
     /**
+     * Registers a deserializer.
+     *
      * @param code code / value to distinguish between deserializers
      * @param deserializer deserializer instance
      */
index 78a361803b01b783795b12d8e2b31cb63ed28124..ea909f2f870a83c47eff8e3e1e5c95c082126bcc 100644 (file)
@@ -13,16 +13,20 @@ import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.InstructionChoice;
 
 /**
+ * Helper class for registering instruction serializers.
+ *
  * @author michal.polkorab
  */
 public class InstructionSerializerRegistryHelper {
 
-    private short version;
-    private SerializerRegistry serializerRegistry;
+    private final short version;
+    private final SerializerRegistry serializerRegistry;
 
     /**
+     * Constructor.
+     *
      * @param version Openflow wire version
-     * @param serializerRegistry
+     * @param serializerRegistry registry to be filled with message serializers
      */
     public InstructionSerializerRegistryHelper(short version, SerializerRegistry serializerRegistry) {
         this.version = version;
@@ -30,13 +34,14 @@ public class InstructionSerializerRegistryHelper {
     }
 
     /**
-     * Registers given serializer
-     * @param instructionType
-     * @param serializer
+     * Registers given serializer.
+     *
+     * @param instructionType instruction type
+     * @param serializer serializer instance
      */
     public <T extends InstructionChoice> void registerSerializer(Class<T> instructionType,
             OFGeneralSerializer serializer) {
         serializerRegistry.registerSerializer(new InstructionSerializerKey<>(version,
                 instructionType, null), serializer);
     }
-}
\ No newline at end of file
+}
index 44534720c728db153de3089e0ef48f228fe666e0..0a3a9d209681903d1ca9d2492506bbb9a91be8da 100644 (file)
@@ -9,10 +9,8 @@
 package org.opendaylight.openflowjava.protocol.impl.util;
 
 import io.netty.buffer.ByteBuf;
-
 import java.util.ArrayList;
 import java.util.List;
-
 import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
 import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
@@ -23,8 +21,9 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * @author michal.polkorab
+ * Deserializes list.
  *
+ * @author michal.polkorab
  */
 public final class ListDeserializer {
     private static final Logger LOG = LoggerFactory.getLogger(ListDeserializer.class);
@@ -34,7 +33,8 @@ public final class ListDeserializer {
     }
 
     /**
-     * Deserializes items into list
+     * Deserializes items into list.
+     *
      * @param version openflow wire version
      * @param length length of list in ByteBuf (bytes)
      * @param input input buffer
@@ -48,7 +48,7 @@ public final class ListDeserializer {
         if (input.readableBytes() > 0) {
             items = new ArrayList<>();
             int startIndex = input.readerIndex();
-            while ((input.readerIndex() - startIndex) < length){
+            while (input.readerIndex() - startIndex < length) {
                 OFDeserializer<E> deserializer = registry.getDeserializer(keyMaker.make(input));
                 E item = deserializer.deserialize(input);
                 items.add(item);
@@ -58,7 +58,8 @@ public final class ListDeserializer {
     }
 
     /**
-     * Deserializes headers of items into list (used in MultipartReplyMessage - Table features)
+     * Deserializes headers of items into list (used in MultipartReplyMessage - Table features).
+     *
      * @param version openflow wire version
      * @param length length of list in ByteBuf (bytes)
      * @param input input buffer
@@ -73,7 +74,7 @@ public final class ListDeserializer {
             items = new ArrayList<>();
             int startIndex = input.readerIndex();
             boolean exceptionLogged = false;
-            while ((input.readerIndex() - startIndex) < length){
+            while (input.readerIndex() - startIndex < length) {
                 HeaderDeserializer<E> deserializer;
                 MessageCodeKey key = keyMaker.make(input);
                 try {
@@ -84,13 +85,13 @@ public final class ListDeserializer {
                     // are not yet (2nd February 2016) fully supported by existing OF Plugin.
                     // TODO - simplify to correctly report exception during deserialization
                     if (!exceptionLogged) {
-                        LOG.warn("Problem during reading table feature property. Skipping unknown feature property: {}." +
-                                "If more information is needed, set org.opendaylight.openflowjava do DEBUG log level.",
-                                key, e.getMessage());
+                        LOG.warn("Problem during reading table feature property. Skipping unknown feature property: {}."
+                            + "If more information is needed, set org.opendaylight.openflowjava do DEBUG log level.",
+                            key, e.getMessage());
                         if (LOG.isDebugEnabled()) {
                             LOG.debug("Detailed exception: {}", e);
                             LOG.debug("This exception is logged only once for each multipart reply (table features) to "
-                                    + "prevent log flooding. There might be more of table features related exceptions.");
+                                + "prevent log flooding. There might be more of table features related exceptions.");
                         }
                         exceptionLogged = true;
                     }
index 7392be7612993287bcc1e65832c195bfa77e538f..12b45a1f6e5f969dffa6c75425db2263b6e2ca91 100644 (file)
@@ -9,26 +9,26 @@
 package org.opendaylight.openflowjava.protocol.impl.util;
 
 import io.netty.buffer.ByteBuf;
-
 import java.util.List;
-
 import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
 import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 
 /**
- * Serializes list items and their headers
+ * Serializes list items and their headers.
+ *
  * @author michal.polkorab
  */
-public abstract class ListSerializer {
+public final class ListSerializer {
 
     private ListSerializer() {
         //not called
     }
 
     /**
-     * Serializes item list
+     * Serializes item list.
+     *
      * @param list list of items to be serialized
      * @param keyMaker creates key for registry lookup
      * @param registry stores serializers
@@ -45,7 +45,8 @@ public abstract class ListSerializer {
     }
 
     /**
-     * Serializes headers of items in list
+     * Serializes headers of items in list.
+     *
      * @param list list of items to be serialized
      * @param keyMaker creates key for registry lookup
      * @param registry stores serializers
@@ -60,5 +61,4 @@ public abstract class ListSerializer {
             }
         }
     }
-
 }
index 0a6852defe69f9a7977c7470f4c02d402821588e..1d58128a368bd9d43e6da455be7c443954d601a0 100644 (file)
@@ -9,9 +9,7 @@
 package org.opendaylight.openflowjava.protocol.impl.util;
 
 import io.netty.buffer.ByteBuf;
-
 import java.util.List;
-
 import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
 import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
@@ -23,7 +21,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder;
 
 /**
- * Deserializes ofp_match (OpenFlow v1.3) and its oxm_fields structures
+ * Deserializes ofp_match (OpenFlow v1.3) and its oxm_fields structures.
+ *
  * @author timotej.kubas
  * @author michal.polkorab
  */
@@ -39,14 +38,14 @@ public class MatchDeserializer implements OFDeserializer<Match>,
             int type = input.readUnsignedShort();
             int length = input.readUnsignedShort();
             switch (type) {
-            case 0:
-                builder.setType(StandardMatchType.class);
-                break;
-            case 1:
-                builder.setType(OxmMatchType.class);
-                break;
-            default:
-                break;
+                case 0:
+                    builder.setType(StandardMatchType.class);
+                    break;
+                case 1:
+                    builder.setType(OxmMatchType.class);
+                    break;
+                default:
+                    break;
             }
             CodeKeyMaker keyMaker = CodeKeyMakerFactory
                     .createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);
index 96d01c3dc847ba24b6bf35db46881cef25f0b8e8..332e1263dee5dc8fd028e83f3d4d4e97990834f9 100644 (file)
@@ -13,19 +13,21 @@ import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey
 import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
 
 /**
- * @author michal.polkorab
+ * Helper class for registering match entry deserializers.
  *
+ * @author michal.polkorab
  */
 public class MatchEntryDeserializerRegistryHelper {
 
-    private short version;
-    private DeserializerRegistry registry;
-    private int oxmClass;
+    private final short version;
+    private final DeserializerRegistry registry;
+    private final int oxmClass;
 
     /**
+     * Constructor.
+     *
      * @param version wire protocol version
-     * @param oxmClass oxm_class that will be used for match entry deserializer
-     *  registration
+     * @param oxmClass oxm_class that will be used for match entry deserializer registration
      * @param deserializerRegistry registry to be filled with message deserializers
      */
     public MatchEntryDeserializerRegistryHelper(short version, int oxmClass,
@@ -36,7 +38,8 @@ public class MatchEntryDeserializerRegistryHelper {
     }
 
     /**
-     * Registers match entry deserializer under provided oxmfield ()
+     * Registers match entry deserializer under provided oxmfield.
+     *
      * @param oxmField oxm_field value/code
      * @param deserializer deserializer instance
      */
@@ -52,4 +55,4 @@ public class MatchEntryDeserializerRegistryHelper {
         key.setExperimenterId(expId);
         registry.registerDeserializer(key, deserializer);
     }
-}
\ No newline at end of file
+}
index d9c76295e74d9e261631459246f68f2f391cd06b..0408cfb34bad35e5f41f46d5e7236eb3b5e9a493 100644 (file)
@@ -15,19 +15,23 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
 
 /**
+ * Helper class for registering match entry serializers.
+ *
  * @author michal.polkorab
  * @param <C> OXM class
  */
 public class MatchEntrySerializerRegistryHelper<C extends OxmClassBase> {
 
-    private short version;
-    private Class<C> generalClass;
-    private SerializerRegistry serializerRegistry;
+    private final short version;
+    private final Class<C> generalClass;
+    private final SerializerRegistry serializerRegistry;
 
     /**
+     * Constructor.
+     *
      * @param version Openflow wire version
-     * @param generalClass
-     * @param serializerRegistry
+     * @param generalClass class that will be used for match entry serializer registration
+     * @param serializerRegistry registry to be filled with message serializers
      */
     public MatchEntrySerializerRegistryHelper(short version, Class<C> generalClass,
             SerializerRegistry serializerRegistry) {
@@ -37,9 +41,10 @@ public class MatchEntrySerializerRegistryHelper<C extends OxmClassBase> {
     }
 
     /**
-     * Registers given serializer
-     * @param specificClass
-     * @param serializer
+     * Registers the given serializer.
+     *
+     * @param specificClass the MatchField class
+     * @param serializer the serializer instance
      */
     public <F extends MatchField> void registerSerializer(
             Class<F> specificClass, OFGeneralSerializer serializer) {
@@ -49,15 +54,16 @@ public class MatchEntrySerializerRegistryHelper<C extends OxmClassBase> {
     }
 
     /**
-     * Registers ExperimenterClass type match serializer
-     * @param specificClass
-     * @param serializer
+     * Registers ExperimenterClass type match serializer.
+     *
+     * @param specificClass the MatchField class
+     * @param serializer the serializer instance
      */
     public <F extends MatchField> void registerExperimenterSerializer(
             Class<F> specificClass, long expId, OFGeneralSerializer serializer) {
-        MatchEntrySerializerKey<?, ?> key = new MatchEntrySerializerKey<>(version, ExperimenterClass.class, specificClass);
+        MatchEntrySerializerKey<?, ?> key = new MatchEntrySerializerKey<>(
+                version, ExperimenterClass.class, specificClass);
         key.setExperimenterId(expId);
         serializerRegistry.registerSerializer(key, serializer);
     }
-
 }
index 7ff074ae7f68bed08513b9b287997314d444c1be..c04126a0af1a002bf2c44e0a22bdd16f8cdc50d5 100644 (file)
@@ -16,7 +16,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10Builder;
 
 /**
- * Deserializes ofp_match (OpenFlow v1.0) structure
+ * Deserializes ofp_match (OpenFlow v1.0) structure.
+ *
  * @author michal.polkorab
  */
 public class OF10MatchDeserializer implements OFDeserializer<MatchV10> {
@@ -25,10 +26,10 @@ public class OF10MatchDeserializer implements OFDeserializer<MatchV10> {
     private static final byte PADDING_IN_MATCH_2 = 2;
     private static final byte NW_SRC_BITS = 6;
     private static final byte NW_SRC_SHIFT = 8;
-    private static final int NW_SRC_MASK = ((1 << NW_SRC_BITS) - 1) << NW_SRC_SHIFT;
+    private static final int NW_SRC_MASK = (1 << NW_SRC_BITS) - 1 << NW_SRC_SHIFT;
     private static final byte NW_DST_BITS = 6;
     private static final byte NW_DST_SHIFT = 14;
-    private static final int NW_DST_MASK = ((1 << NW_DST_BITS) - 1) << NW_DST_SHIFT;
+    private static final int NW_DST_MASK = (1 << NW_DST_BITS) - 1 << NW_DST_SHIFT;
 
     @Override
     public MatchV10 deserialize(final ByteBuf input) {
@@ -56,27 +57,29 @@ public class OF10MatchDeserializer implements OFDeserializer<MatchV10> {
     }
 
     /**
-     * Decodes FlowWildcards
+     * Decodes FlowWildcards.
+     *
      * @param input input ByteBuf
      * @return decoded FlowWildcardsV10
      */
     public static FlowWildcardsV10 createWildcards(final long input) {
-        boolean inPort = (input & (1 << 0)) != 0;
-        boolean dlVLAN = (input & (1 << 1)) != 0;
-        boolean dlSrc = (input & (1 << 2)) != 0;
-        boolean dlDst = (input & (1 << 3)) != 0;
-        boolean dLType = (input & (1 << 4)) != 0;
-        boolean nwProto = (input & (1 << 5)) != 0;
-        boolean tpSrc = (input & (1 << 6)) != 0;
-        boolean tpDst = (input & (1 << 7)) != 0;
-        boolean dlVLANpcp = (input & (1 << 20)) != 0;
-        boolean nwTos = (input & (1 << 21)) != 0;
-        return new FlowWildcardsV10(dlDst, dlSrc, dLType, dlVLAN,
+        boolean inPort = (input & 1 << 0) != 0;
+        boolean dlVLAN = (input & 1 << 1) != 0;
+        boolean dlSrc = (input & 1 << 2) != 0;
+        boolean dlDst = (input & 1 << 3) != 0;
+        boolean dlType = (input & 1 << 4) != 0;
+        boolean nwProto = (input & 1 << 5) != 0;
+        boolean tpSrc = (input & 1 << 6) != 0;
+        boolean tpDst = (input & 1 << 7) != 0;
+        boolean dlVLANpcp = (input & 1 << 20) != 0;
+        boolean nwTos = (input & 1 << 21) != 0;
+        return new FlowWildcardsV10(dlDst, dlSrc, dlType, dlVLAN,
                 dlVLANpcp, inPort, nwProto, nwTos, tpDst, tpSrc);
     }
 
     /**
-     * Decodes NwSrcMask from FlowWildcards (represented as uint32)
+     * Decodes NwSrcMask from FlowWildcards (represented as uint32).
+     *
      * @param input binary FlowWildcards
      * @return decoded NwSrcMask
      */
@@ -85,7 +88,8 @@ public class OF10MatchDeserializer implements OFDeserializer<MatchV10> {
     }
 
     /**
-     * Decodes NwDstMask from FlowWildcards (represented as uint32)
+     * Decodes NwDstMask from FlowWildcards (represented as uint32).
+     *
      * @param input binary FlowWildcards
      * @return decoded NwDstMask
      */
index a9db0af9d36753a374158762e718c8aaac108a7c..4379dfbb961826d02fa302615c497111c8fff58c 100644 (file)
@@ -17,7 +17,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev13
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10;
 
 /**
- * Serializes ofp_match (OpenFlow v1.0) structure
+ * Serializes ofp_match (OpenFlow v1.0) structure.
+ *
  * @author michal.polkorab
  */
 public class OF10MatchSerializer implements OFSerializer<MatchV10> {
@@ -28,7 +29,8 @@ public class OF10MatchSerializer implements OFSerializer<MatchV10> {
     private static final byte NW_DST_SHIFT = 14;
 
     /**
-     * Serializes ofp_match (OpenFlow v1.0)
+     * Serializes ofp_match (OpenFlow v1.0).
+     *
      * @param outBuffer output ByteBuf
      * @param match match to be serialized
      */
@@ -64,9 +66,8 @@ public class OF10MatchSerializer implements OFSerializer<MatchV10> {
         bitmask |= ByteBufUtils.fillBitMask(20,
                 wildcards.isDLVLANPCP(),
                 wildcards.isNWTOS());
-        bitmask |= ((32 - srcMask) << NW_SRC_SHIFT);
-        bitmask |= ((32 - dstMask) << NW_DST_SHIFT);
+        bitmask |= 32 - srcMask << NW_SRC_SHIFT;
+        bitmask |= 32 - dstMask << NW_DST_SHIFT;
         return bitmask;
     }
-
 }
index 7022c98d5541ef25ce853587d36d1750b922378c..8a24642031e41678084fdd26aa077c8b99dbd729 100644 (file)
@@ -9,9 +9,7 @@
 package org.opendaylight.openflowjava.protocol.impl.util;
 
 import io.netty.buffer.ByteBuf;
-
 import java.util.List;
-
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
 import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
 import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
@@ -27,7 +25,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Serializes ofp_match (OpenFlow v1.3)
+ * Serializes ofp_match (OpenFlow v1.3).
+ *
  * @author michal.polkorab
  * @author timotej.kubas
  */
@@ -43,7 +42,7 @@ public class OF13MatchSerializer implements OFSerializer<Match>, SerializerRegis
             LOG.debug("Match is null");
             return;
         }
-        int matchStartIndex = outBuffer.writerIndex();
+        final int matchStartIndex = outBuffer.writerIndex();
         serializeType(match, outBuffer);
         int matchLengthIndex = outBuffer.writerIndex();
         outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);
@@ -66,7 +65,8 @@ public class OF13MatchSerializer implements OFSerializer<Match>, SerializerRegis
     }
 
     /**
-     * Serializes MatchEntries
+     * Serializes MatchEntries.
+     *
      * @param matchEntries list of match entries (oxm_fields)
      * @param out output ByteBuf
      */
@@ -94,5 +94,4 @@ public class OF13MatchSerializer implements OFSerializer<Match>, SerializerRegis
     public void injectSerializerRegistry(SerializerRegistry serializerRegistry) {
         this.registry = serializerRegistry;
     }
-
 }
index 23f2f3c2fd451920034a52a6836e12faab91e45e..1e1b1079ba7bb7d613aa04ea3d1c948426cd9691 100644 (file)
@@ -13,7 +13,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev13
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10;
 
 /**
- * Used for common structures translation / conversion
+ * Used for common structures translation / conversion.
  *
  * @author michal.polkorab
  */
@@ -24,57 +24,64 @@ public abstract class OpenflowUtils {
     }
 
     /**
-     * Creates PortState (OF v1.0) from input
+     * Creates PortState (OF v1.0) from input.
+     *
      * @param input value read from buffer
      * @return port state
      */
-    public static PortStateV10 createPortState(long input){
-        final Boolean psLinkDown = ((input) & (1<<0)) != 0;
-        final Boolean psBlocked = ((input) & (1<<1)) != 0;
-        final Boolean psLive = ((input) & (1<<2)) != 0;
-        final Boolean psStpListen = ((input) & (1<<8)) == 0;
-        final Boolean psStpLearn = ((input) & (1<<8)) != 0;
-        final Boolean psStpForward = ((input) & (1<<9)) != 0; // equals 2 << 8
-        final Boolean psStpBlock = (((input) & (1<<9)) != 0) && (((input) & (1<<8)) != 0); // equals 3 << 8
-        final Boolean psStpMask = ((input) & (1<<10)) != 0; // equals 4 << 8
-        return new PortStateV10(psBlocked, psLinkDown, psLive, psStpBlock, psStpForward, psStpLearn, psStpListen, psStpMask);
+    public static PortStateV10 createPortState(long input) {
+        final Boolean psLinkDown = (input & 1 << 0) != 0;
+        final Boolean psBlocked = (input & 1 << 1) != 0;
+        final Boolean psLive = (input & 1 << 2) != 0;
+        final Boolean psStpListen = (input & 1 << 8) == 0;
+        final Boolean psStpLearn = (input & 1 << 8) != 0;
+        // equals 2 << 8
+        final Boolean psStpForward = (input & 1 << 9) != 0;
+        // equals 3 << 8
+        final Boolean psStpBlock = (input & 1 << 9) != 0 && (input & 1 << 8) != 0;
+        // equals 4 << 8
+        final Boolean psStpMask = (input & 1 << 10) != 0;
+        return new PortStateV10(psBlocked, psLinkDown, psLive, psStpBlock, psStpForward, psStpLearn, psStpListen,
+                psStpMask);
     }
 
     /**
-     * Creates PortConfig (OF v1.0) from input
+     * Creates PortConfig (OF v1.0) from input.
+     *
      * @param input value read from buffer
      * @return port state
      */
-    public static PortConfigV10 createPortConfig(long input){
-        final Boolean pcPortDown = ((input) & (1<<0)) != 0;
-        final Boolean pcNoStp = ((input) & (1<<1)) != 0;
-        final Boolean pcNoRecv = ((input) & (1<<2)) != 0;
-        final Boolean pcNoRecvStp = ((input) & (1<<3)) != 0;
-        final Boolean pcNoFlood = ((input) & (1<<4)) != 0;
-        final Boolean pcNoFwd  = ((input) & (1<<5)) != 0;
-        final Boolean pcNoPacketIn = ((input) & (1<<6)) != 0;
+    public static PortConfigV10 createPortConfig(long input) {
+        final Boolean pcPortDown = (input & 1 << 0) != 0;
+        final Boolean pcNoStp = (input & 1 << 1) != 0;
+        final Boolean pcNoRecv = (input & 1 << 2) != 0;
+        final Boolean pcNoRecvStp = (input & 1 << 3) != 0;
+        final Boolean pcNoFlood = (input & 1 << 4) != 0;
+        final Boolean pcNoFwd = (input & 1 << 5) != 0;
+        final Boolean pcNoPacketIn = (input & 1 << 6) != 0;
         return new PortConfigV10(pcNoFlood, pcNoFwd, pcNoPacketIn, pcNoRecv, pcNoRecvStp, pcNoStp, pcPortDown);
     }
 
     /**
-     * Creates PortFeatures (OF v1.0) from input
+     * Creates PortFeatures (OF v1.0) from input.
+     *
      * @param input value read from buffer
      * @return port state
      */
-    public static PortFeaturesV10 createPortFeatures(long input){
-        final Boolean pf10mbHd = ((input) & (1<<0)) != 0;
-        final Boolean pf10mbFd = ((input) & (1<<1)) != 0;
-        final Boolean pf100mbHd = ((input) & (1<<2)) != 0;
-        final Boolean pf100mbFd = ((input) & (1<<3)) != 0;
-        final Boolean pf1gbHd = ((input) & (1<<4)) != 0;
-        final Boolean pf1gbFd = ((input) & (1<<5)) != 0;
-        final Boolean pf10gbFd = ((input) & (1<<6)) != 0;
-        final Boolean pfCopper = ((input) & (1<<7)) != 0;
-        final Boolean pfFiber = ((input) & (1<<8)) != 0;
-        final Boolean pfAutoneg = ((input) & (1<<9)) != 0;
-        final Boolean pfPause = ((input) & (1<<10)) != 0;
-        final Boolean pfPauseAsym = ((input) & (1<<11)) != 0;
+    public static PortFeaturesV10 createPortFeatures(long input) {
+        final Boolean pf10mbHd = (input & 1 << 0) != 0;
+        final Boolean pf10mbFd = (input & 1 << 1) != 0;
+        final Boolean pf100mbHd = (input & 1 << 2) != 0;
+        final Boolean pf100mbFd = (input & 1 << 3) != 0;
+        final Boolean pf1gbHd = (input & 1 << 4) != 0;
+        final Boolean pf1gbFd = (input & 1 << 5) != 0;
+        final Boolean pf10gbFd = (input & 1 << 6) != 0;
+        final Boolean pfCopper = (input & 1 << 7) != 0;
+        final Boolean pfFiber = (input & 1 << 8) != 0;
+        final Boolean pfAutoneg = (input & 1 << 9) != 0;
+        final Boolean pfPause = (input & 1 << 10) != 0;
+        final Boolean pfPauseAsym = (input & 1 << 11) != 0;
         return new PortFeaturesV10(pf100mbFd, pf100mbHd, pf10gbFd, pf10mbFd, pf10mbHd,
                 pf1gbFd, pf1gbHd, pfAutoneg, pfCopper, pfFiber, pfPause, pfPauseAsym);
     }
-}
\ No newline at end of file
+}
index 6d527c4a043d2bcefc19aa8fde481b5815bee9c2..3ee709722aebcca95c35b3c8b18a50710b1f366e 100644 (file)
@@ -13,14 +13,17 @@ import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
 
 /**
  * Helper class for deserializer registration.
+ *
  * @author michal.polkorab
  */
 public class SimpleDeserializerRegistryHelper {
 
-    private short version;
-    private DeserializerRegistry registry;
+    private final short version;
+    private final DeserializerRegistry registry;
 
     /**
+     * Constructor.
+     *
      * @param version wire protocol version
      * @param deserializerRegistry registry to be filled with message deserializers
      */
@@ -43,5 +46,4 @@ public class SimpleDeserializerRegistryHelper {
             ((VersionAssignableFactory) deserializer).assignVersion(version);
         }
     }
-
 }
index 3ace85ab7cfbbaa36eae45ff0a90cd600056fd66..ef5162f9552581033b98b9f185ddba57b8b6da99 100644 (file)
@@ -11,16 +11,18 @@ package org.opendaylight.openflowjava.protocol.impl.util;
 import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
 
 /**
+ * Interface for a type key maker.
+ *
  * @author michal.polkorab
- * @param <T>
+ * @param <T> type the key maker is based on
  */
 public interface TypeKeyMaker<T> {
 
     /**
-     * @param entry
-     * @return key that will be used for serializer lookup in
-     * the serializer registry
+     * Makes a MessageTypeKey.
+     *
+     * @param entry the entry for which to create the key
+     * @return key that will be used for serializer lookup in the serializer registry
      */
-    abstract MessageTypeKey<?> make(T entry);
-
+    MessageTypeKey<?> make(T entry);
 }
index 2312685c6425d297d76f7392f0691864843606d5..9cca6acd518cbc4c3d3ed2d555e5940cb35e7819 100644 (file)
@@ -21,18 +21,20 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Expe
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
 
 /**
- * Creates KeyMakers
+ * Creates KeyMakers.
+ *
  * @author michal.polkorab
  */
-public abstract class TypeKeyMakerFactory {
+public final class TypeKeyMakerFactory {
 
     private TypeKeyMakerFactory() {
         //not called
     }
 
     /**
-     * @param version openflow wire version that shall be used
-     *  in lookup key
+     * Creates a key maker for MatchEntry instances.
+     *
+     * @param version openflow wire version that shall be used in lookup key
      * @return lookup key
      */
     public static TypeKeyMaker<MatchEntry> createMatchEntriesKeyMaker(short version) {
@@ -54,8 +56,9 @@ public abstract class TypeKeyMakerFactory {
     }
 
     /**
-     * @param version openflow wire version that shall be used
-     *  in lookup key
+     * Creates a key maker for Action instances.
+     *
+     * @param version openflow wire version that shall be used in lookup key
      * @return lookup key
      */
     public static TypeKeyMaker<Action> createActionKeyMaker(short version) {
@@ -74,8 +77,9 @@ public abstract class TypeKeyMakerFactory {
     }
 
     /**
-     * @param version openflow wire version that shall be used
-     *  in lookup key
+     * Creates a key maker for Instruction instances.
+     *
+     * @param version openflow wire version that shall be used in lookup key
      * @return lookup key
      */
     public static TypeKeyMaker<Instruction> createInstructionKeyMaker(short version) {
index b360f89fd4cda606c17047a5521add6dd0895b24..e96b1e196c4ba94267c485d85db763c1cd30ab7e 100644 (file)
@@ -11,16 +11,18 @@ import java.util.Map;
 import org.opendaylight.openflowjava.protocol.api.keys.TypeToClassKey;
 
 /**
- * @author michal.polkorab
+ * Helper for initializing type to class mappings.
  *
+ * @author michal.polkorab
  */
 public class TypeToClassInitHelper {
 
-    private short version;
-    private Map<TypeToClassKey, Class<?>> messageClassMap;
+    private final short version;
+    private final Map<TypeToClassKey, Class<?>> messageClassMap;
 
     /**
-     * Constructor
+     * Constructor.
+     *
      * @param version protocol wire version
      * @param messageClassMap map which stores type to class mapping
      */
@@ -31,7 +33,8 @@ public class TypeToClassInitHelper {
     }
 
     /**
-     * Registers Class int the type to class mapping
+     * Registers Class int the type to class mapping.
+     *
      * @param type code value for message type / class
      * @param clazz class corresponding to the code
      */
index d10f8fa6c2096ee5cebc8756dfd4fb00e40fa0e8..366ef95afa2f298e1d429cab4ca39d9fb09e7ed5 100644 (file)
@@ -17,20 +17,22 @@ public abstract class VersionAssignableFactory {
     private Short version;
 
     /**
-     * @param version OpenFlow protocol version
+     * Assigns the version.
+     *
+     * @param newVersion OpenFlow protocol version
      */
-    public void assignVersion(@Nonnull final Short version) {
+    public void assignVersion(@Nonnull final Short newVersion) {
         if (this.version == null) {
-            this.version = version;
+            this.version = newVersion;
         } else {
             throw new IllegalStateException("Version already assigned: " + this.version);
         }
     }
 
     /**
-     * @return OpenFlow protocol version
+     * Returns the OpenFlow protocol version.
      */
     protected Short getVersion() {
         return this.version;
     }
-}
\ No newline at end of file
+}
index 33bd50aa8863b7eb2d16f9e2b381774ef6551c67..6543cbd835a3b4f0ff97900159cbaa058f91b132 100644 (file)
@@ -9,18 +9,19 @@
 package org.opendaylight.openflowjava.statistics;
 
 import java.util.concurrent.atomic.AtomicLong;
+
 /**
- * Counts statistics
+ * Counts statistics.
  *
  * @author madamjak
  */
 public class Counter {
 
-    private AtomicLong counterValue;
-    private AtomicLong counterLastReadValue;
+    private final AtomicLong counterValue;
+    private final AtomicLong counterLastReadValue;
 
     /**
-     * Default constructor
+     * Default constructor.
      */
     public Counter() {
         counterValue = new AtomicLong(0L);
@@ -28,9 +29,9 @@ public class Counter {
     }
 
     /**
-     * Increment current counter value
+     * Increment current counter value.
      */
-    public void incrementCounter(){
+    public void incrementCounter() {
         counterValue.incrementAndGet();
     }
 
@@ -44,7 +45,8 @@ public class Counter {
     }
 
     /**
-     * get current value of counter and rewrite CounterLastReadValue by current value
+     * Gets current value of counter and rewrite CounterLastReadValue by current value.
+     *
      * @return  the current value of counter
      */
     public long getCounterValue() {
@@ -52,33 +54,34 @@ public class Counter {
     }
 
     /**
-     * get current counter value
+     * Gets current counter value.
+     *
      * @param modifyLastReadValue
      *      true - CounterLastReadValue will be rewritten by current CounterValue
      *      false - no change CounterLastReadValue
      * @return the current value of counter
      */
     public long getCounterValue(boolean modifyLastReadValue) {
-        if(modifyLastReadValue){
+        if (modifyLastReadValue) {
             counterLastReadValue.set(counterValue.get());
         }
         return counterValue.get();
     }
 
     /**
-     * set current counter value and CounterLastReadValue to 0 (zero)
+     * Sets current counter value and CounterLastReadValue to 0 (zero).
      */
-    public void reset(){
-        counterValue.set(0l);
-        counterLastReadValue.set(0l);
+    public void reset() {
+        counterValue.set(0L);
+        counterLastReadValue.set(0L);
     }
 
     /**
-     * @return last and current count for specified statistic
+     * Returns the last and current count for specified statistic.
      */
     public String getStat() {
         long cntPrevVal = getCounterLastReadValue();
         long cntCurValue = getCounterValue();
-        return String.format("+%d | %d",cntCurValue-cntPrevVal,cntCurValue);
+        return String.format("+%d | %d",cntCurValue - cntPrevVal,cntCurValue);
     }
 }
index 60b1c6da35983c571a691c8a417545a2cfffb59e..e16b734bc312f1473d756ac483865d514d81f743 100644 (file)
@@ -9,49 +9,58 @@
 package org.opendaylight.openflowjava.statistics;
 
 /**
- * Enumeration of events to be counted with StatisticsCounters
- * @author madamjak
+ * Enumeration of events to be counted with StatisticsCounters.
  *
+ * @author madamjak
  */
 public enum CounterEventTypes {
     /**
-     * enter message to OFJ and pass to downstream
+     * enter message to OFJ and pass to downstream.
      */
     DS_ENTERED_OFJAVA,
+
     /**
-     * flow-mod is entered
+     * flow-mod is entered.
      */
     DS_FLOW_MODS_ENTERED,
+
     /**
-     * encode message successfully
+     * encode message successfully.
      */
     DS_ENCODE_SUCCESS,
+
     /**
-     * fail encode message
+     * fail encode message.
      */
     DS_ENCODE_FAIL,
+
     /**
-     * flow-mod encoded and sent to downstream
+     * flow-mod encoded and sent to downstream.
      */
     DS_FLOW_MODS_SENT,
+
     /**
-     * packetIn message got dropped -filtering is active
+     * packetIn message got dropped -filtering is active.
      */
     US_DROPPED_PACKET_IN,
+
     /**
-     * receive message and pass to upstream
+     * receive message and pass to upstream.
      */
     US_RECEIVED_IN_OFJAVA,
+
     /**
-     * decode message successfully
+     * decode message successfully.
      */
     US_DECODE_SUCCESS,
+
     /**
-     * fail decode message
+     * fail decode message.
      */
     US_DECODE_FAIL,
+
     /**
-     * pass message to consumer (end of upstream)
+     * pass message to consumer (end of upstream).
      */
     US_MESSAGE_PASS;
-}
\ No newline at end of file
+}
index d0c071e50f8d3b7eb6f909a3ea09f1d7bea0d66c..e4f395412f587a9058b414a2045affe52a10c81d 100644 (file)
@@ -16,43 +16,41 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Singleton class to hold and process counters
- * @author madamjak
+ * Singleton class to hold and process counters.
  *
+ * @author madamjak
  */
 public final class StatisticsCounters implements StatisticsHandler {
 
     /**
-     * Default delay between two writings into log (milliseconds)
+     * Default delay between two writings into log (milliseconds).
      */
     public static final int DEFAULT_LOG_REPORT_PERIOD = 10000;
+
     /**
-     * Minimal delay between two writings into log (milliseconds)
+     * Minimal delay between two writings into log (milliseconds).
      */
     public static final int MINIMAL_LOG_REPORT_PERIOD = 500;
+
     private static StatisticsCounters instanceHolder;
     private static final Logger LOG = LoggerFactory.getLogger(StatisticsCounters.class);
 
     private Timer logReporter;
     private int logReportPeriod;
     private boolean runLogReport;
-    private Map<CounterEventTypes, Counter> countersMap;
+    private final Map<CounterEventTypes, Counter> countersMap;
     private boolean runCounting;
     // array to hold enabled counter types
-    private CounterEventTypes[] enabledCounters = {
-                    CounterEventTypes.DS_ENCODE_FAIL,
-                    CounterEventTypes.DS_ENCODE_SUCCESS,
-                    CounterEventTypes.DS_ENTERED_OFJAVA,
-                    CounterEventTypes.DS_FLOW_MODS_ENTERED,
-                    CounterEventTypes.DS_FLOW_MODS_SENT,
-            CounterEventTypes.US_DROPPED_PACKET_IN,
-                    CounterEventTypes.US_DECODE_FAIL,
-                    CounterEventTypes.US_DECODE_SUCCESS,
-                    CounterEventTypes.US_MESSAGE_PASS,
-                    CounterEventTypes.US_RECEIVED_IN_OFJAVA};
-
-    /**
-     * Get instance of statistics counters, first created object does not start counting and log reporting
+    private final CounterEventTypes[] enabledCounters = { CounterEventTypes.DS_ENCODE_FAIL,
+        CounterEventTypes.DS_ENCODE_SUCCESS, CounterEventTypes.DS_ENTERED_OFJAVA,
+        CounterEventTypes.DS_FLOW_MODS_ENTERED, CounterEventTypes.DS_FLOW_MODS_SENT,
+        CounterEventTypes.US_DROPPED_PACKET_IN, CounterEventTypes.US_DECODE_FAIL,
+        CounterEventTypes.US_DECODE_SUCCESS, CounterEventTypes.US_MESSAGE_PASS,
+        CounterEventTypes.US_RECEIVED_IN_OFJAVA };
+
+    /**
+     * Get instance of statistics counters, first created object does not start counting and log reporting.
+     *
      * @return an instance
      */
     public static synchronized StatisticsCounters getInstance() {
@@ -64,7 +62,7 @@ public final class StatisticsCounters implements StatisticsHandler {
 
     private StatisticsCounters() {
         countersMap = new ConcurrentHashMap<>();
-        for(CounterEventTypes cet : enabledCounters){
+        for (CounterEventTypes cet : enabledCounters) {
             countersMap.put(cet, new Counter());
         }
         runCounting = false;
@@ -74,52 +72,55 @@ public final class StatisticsCounters implements StatisticsHandler {
     }
 
     /**
-     * Start counting (counters are set to 0 before counting starts)
+     * Start counting (counters are set to 0 before counting starts).
+     *
      * @param reportToLogs - true = statistic counters will periodically log
      * @param logReportDelay - delay between two logs (in milliseconds)
      */
-    public void startCounting(boolean reportToLogs, int logReportDelay){
+    public void startCounting(boolean reportToLogs, int logReportDelay) {
         if (runCounting) {
             return;
         }
         resetCounters();
         LOG.debug("Counting started...");
-        if(reportToLogs){
+        if (reportToLogs) {
             startLogReport(logReportDelay);
         }
         runCounting = true;
     }
 
     /**
-     * Stop counting, values in counters are untouched, log reporter is stopped
+     * Stop counting, values in counters are untouched, log reporter is stopped.
      */
-    public void stopCounting(){
+    public void stopCounting() {
         runCounting = false;
         LOG.debug("Stop counting...");
         stopLogReport();
     }
 
     /**
-     * Give an information if counting is running
+     * Give an information if counting is running.
+     *
      * @return true, if counting is running, otherwise false
      */
-    public boolean isRunCounting(){
+    public boolean isRunCounting() {
         return runCounting;
     }
 
     /**
-     * Prints statistics with given delay between logs
+     * Prints statistics with given delay between logs.
+     *
      * @param logReportDelay - delay between two logs (in milliseconds)
      * @exception IllegalArgumentException if logReportDelay is less than 0
      */
-    public void startLogReport(int logReportDelay){
-        if(runLogReport){
+    public void startLogReport(int logReportDelay) {
+        if (runLogReport) {
             return;
         }
-        if(logReportDelay <= 0){
+        if (logReportDelay <= 0) {
             throw new IllegalArgumentException("logReportDelay has to be greater than 0");
         }
-        if(logReportDelay < MINIMAL_LOG_REPORT_PERIOD){
+        if (logReportDelay < MINIMAL_LOG_REPORT_PERIOD) {
             this.logReportPeriod = MINIMAL_LOG_REPORT_PERIOD;
         } else {
             this.logReportPeriod = logReportDelay;
@@ -131,11 +132,11 @@ public final class StatisticsCounters implements StatisticsHandler {
     }
 
     /**
-     * Stops logging, counting continues
+     * Stops logging, counting continues.
      */
-    public void stopLogReport(){
-        if(runLogReport){
-            if(logReporter != null){
+    public void stopLogReport() {
+        if (runLogReport) {
+            if (logReporter != null) {
                 logReporter.cancel();
                 LOG.debug("Statistics log reporter has been canceled");
             }
@@ -147,36 +148,38 @@ public final class StatisticsCounters implements StatisticsHandler {
      * Give an information if log reporter is running (statistics are write into logs).
      * @return true if log reporter writes statistics into log, otherwise false
      */
-    public boolean isRunLogReport(){
+    public boolean isRunLogReport() {
         return runLogReport;
     }
 
     /**
-     * @return the current delay between two writings into logs
+     * Returns the current delay between two writings into logs.
      */
     public int getLogReportPeriod() {
         return logReportPeriod;
     }
 
     /**
-     * @return the enabled counters
+     * Returns the enabled counters.
      */
     protected CounterEventTypes[] getEnabledCounters() {
         return enabledCounters;
     }
+
     /**
-     * @return the countersMap
+     * Returns the countersMap.
      */
     protected Map<CounterEventTypes, Counter> getCountersMap() {
         return countersMap;
     }
 
     /**
-     * Give an information if is given counter is enabled
-     * @param counterEventKey
+     * Determines if the given counter is enabled.
+     *
+     * @param counterEventKey the counter key
      * @return true if counter has been Enabled, otherwise false
      */
-    public boolean isCounterEnabled(CounterEventTypes counterEventKey){
+    public boolean isCounterEnabled(CounterEventTypes counterEventKey) {
         if (counterEventKey == null) {
             return false;
         }
@@ -184,7 +187,8 @@ public final class StatisticsCounters implements StatisticsHandler {
     }
 
     /**
-     * Get counter by CounterEventType
+     * Get counter by CounterEventType.
+     *
      * @param counterEventKey key to identify counter (can not be null)
      * @return Counter object or null if counter has not been enabled
      * @throws IllegalArgumentException if counterEventKey is null
@@ -197,12 +201,13 @@ public final class StatisticsCounters implements StatisticsHandler {
     }
 
     /**
-     * Increment value of given counter
+     * Increment value of given counter.
+     *
      * @param counterEventKey key to identify counter
      */
     public void incrementCounter(CounterEventTypes counterEventKey) {
-        if(runCounting){
-            if (isCounterEnabled(counterEventKey)){
+        if (runCounting) {
+            if (isCounterEnabled(counterEventKey)) {
                 countersMap.get(counterEventKey).incrementCounter();
             }
         }
@@ -210,7 +215,7 @@ public final class StatisticsCounters implements StatisticsHandler {
 
     @Override
     public void resetCounters() {
-        for(CounterEventTypes cet : enabledCounters){
+        for (CounterEventTypes cet : enabledCounters) {
             countersMap.get(cet).reset();
         }
         LOG.debug("StaticsCounters has been reset");
@@ -219,28 +224,27 @@ public final class StatisticsCounters implements StatisticsHandler {
     @Override
     public String printStatistics() {
         StringBuilder strBuilder = new StringBuilder();
-        for(CounterEventTypes cet : getEnabledCounters()){
+        for (CounterEventTypes cet : getEnabledCounters()) {
             strBuilder.append(cet.name() + ": " + getCountersMap().get(cet).getStat() + "\n");
         }
         return strBuilder.toString();
     }
 
     /**
-     * internal class to process logReporter
-     * @author madamjak
+     * internal class to process logReporter.
      *
+     * @author madamjak
      */
     private static class LogReporterTask extends TimerTask {
-        private static final Logger LOG = LoggerFactory.getLogger(LogReporterTask.class);
+        private final StatisticsCounters sc;
 
-        private StatisticsCounters sc;
-        public LogReporterTask(StatisticsCounters sc) {
+        LogReporterTask(StatisticsCounters sc) {
             this.sc = sc;
         }
 
         @Override
         public void run() {
-            for(CounterEventTypes cet : sc.getEnabledCounters()){
+            for (CounterEventTypes cet : sc.getEnabledCounters()) {
                 LOG.debug("{}: {}", cet.name(), sc.getCountersMap().get(cet).getStat());
             }
         }