</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <failsOnError>true</failsOnError>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
<!--
Maven Site Configuration
* addresses, classes, etc. We do not require too much, just that the identifiers are serializable (and this
* transferable).
*
- * Implementations are expected to implement {@link #hashCode()} and {@link #equals(Object)} methods in a way, which
- * ensures that objects before and after serialization are considered equal.
+ * <p>Implementations are expected to implement {@link #hashCode()} and {@link #equals(Object)} methods in a way,
+ * which ensures that objects before and after serialization are considered equal.
*
- * Implementations are advised to use the {@link java.io.Externalizable} Proxy pattern to allow future evolution
+ * <p>Implementations are advised to use the {@link java.io.Externalizable} Proxy pattern to allow future evolution
* of their serialization format. For further efficiency, implementation should implement {@link WritableObject},
* so they can be efficiently embedded in other {@link Serializable} objects.
*
- * Note that this class is annotated as {@link ThreadSafe}, hence all implementations are expected to be thread-safe.
+ * <p>Note that this class is annotated as {@link ThreadSafe}, hence all implementations are expected to be
+ * thread-safe.
*/
@ThreadSafe
public interface Identifier extends Serializable, Immutable {
@Override
- boolean equals(Object o);
+ boolean equals(Object obj);
@Override
int hashCode();
package org.opendaylight.yangtools.concepts;
/**
- * Mutable object - object may change it's state during lifecycle.
- *
- * This interface is mutually exclusive with {@link Immutable} and other
- * {@link MutationBehaviour}s.
+ * Mutable object - object may change it's state during lifecycle. This interface is mutually exclusive
+ * with {@link Immutable} and other {@link MutationBehaviour}s.
*
* @author Tony Tkacik
- *
*/
public interface Mutable extends MutationBehaviour<Mutable> {
package org.opendaylight.yangtools.concepts;
/**
- * Mutation behavior
- *
- * This interface is used to prevent same class extends multiple types of MutationBehaviour
+ * Mutation behavior. This interface is used to prevent same class extends multiple types of MutationBehaviour
* such as {@link Immutable} and {@link Mutable} which are mutually exclusive.
*
* @author Tony Tkacik
return new SemVer(major, minor, patch);
}
- public static SemVer valueOf(@Nonnull final String s) {
- final int minorIdx = s.indexOf('.');
+ public static SemVer valueOf(@Nonnull final String str) {
+ final int minorIdx = str.indexOf('.');
if (minorIdx == -1) {
- return create(Integer.parseInt(s));
+ return create(Integer.parseInt(str));
}
final String minorStr;
- final int patchIdx = s.indexOf('.', minorIdx + 1);
+ final int patchIdx = str.indexOf('.', minorIdx + 1);
if (patchIdx == -1) {
- minorStr = s.substring(minorIdx + 1);
+ minorStr = str.substring(minorIdx + 1);
} else {
- minorStr = s.substring(minorIdx + 1, patchIdx);
+ minorStr = str.substring(minorIdx + 1, patchIdx);
}
- return create(Integer.parseInt(s.substring(0, minorIdx), 10), Integer.parseInt(minorStr, 10),
- Integer.parseInt(s.substring(patchIdx + 1), 10));
+ return create(Integer.parseInt(str.substring(0, minorIdx), 10), Integer.parseInt(minorStr, 10),
+ Integer.parseInt(str.substring(patchIdx + 1), 10));
}
/**
- * @return the major
+ * Return the major version number.
+ *
+ * @return major version number
*/
public int getMajor() {
return major;
}
/**
- * @return the minor
+ * Return the minor version number.
+ *
+ * @return minor version number
*/
public int getMinor() {
return minor;
}
/**
- * @return the patch
+ * Return the patch version number.
+ *
+ * @return patch version number
*/
public int getPatch() {
return patch;
}
@Override
- public int compareTo(final SemVer o) {
- int i = Integer.compare(major, o.major);
- if (i == 0) {
- i = Integer.compare(minor, o.minor);
- if (i == 0) {
- return Integer.compare(patch, o.patch);
+ public int compareTo(final SemVer other) {
+ int cmp = Integer.compare(major, other.major);
+ if (cmp == 0) {
+ cmp = Integer.compare(minor, other.minor);
+ if (cmp == 0) {
+ return Integer.compare(patch, other.patch);
}
}
- return i;
+ return cmp;
}
@Override
* public static CLASS readFrom(DataInput in) throws IOException;
* </pre>
*
- * The serialization format provided by this abstraction does not guarantee versioning. Callers are responsible for
- * ensuring the source stream is correctly positioned.
+ * <p>The serialization format provided by this abstraction does not guarantee versioning. Callers are responsible
+ * for ensuring the source stream is correctly positioned.
*
* @author Robert Varga
*/
* serializing counters and similar, which have a wide range, but typically do not use it. The value provided is
* treated as unsigned.
*
- * This methods writes the number of trailing non-zero in the value. It then writes the minimum required bytes
+ * <p>This methods writes the number of trailing non-zero in the value. It then writes the minimum required bytes
* to reconstruct the value by left-padding zeroes. Inverse operation is performed by {@link #readLong(DataInput)}
* or a combination of {@link #readLongHeader(DataInput)} and {@link #readLongBody(DataInput, byte)}.
*
- * Additionally the caller can use the top four bits (i.e. 0xF0) for caller-specific flags. These will be ignored
- * by {@link #readLong(DataInput)}, but can be extracted via {@link #readLongHeader(DataInput)}.
+ * <p>Additionally the caller can use the top four bits (i.e. 0xF0) for caller-specific flags. These will be
+ * ignored by {@link #readLong(DataInput)}, but can be extracted via {@link #readLongHeader(DataInput)}.
*
* @param out Data output
* @param value long value to write
*
* @param in Data input
* @param header Value header, as returned by {@link #readLongHeader(DataInput)}
+ * @return long value
* @throws IOException if an I/O error occurs
* @throws NullPointerException if input is null
*/
* Write two consecutive long values. These values can be read back using {@link #readLongHeader(DataInput)},
* {@link #readFirstLong(DataInput, byte)} and {@link #readSecondLong(DataInput, byte)}.
*
- * This is a more efficient way of serializing two longs than {@link #writeLong(DataOutput, long)}. This is achieved
- * by using the flags field to hold the length of the second long -- hence saving one byte.
+ * <p>This is a more efficient way of serializing two longs than {@link #writeLong(DataOutput, long)}. This is
+ * achieved by using the flags field to hold the length of the second long -- hence saving one byte.
*
* @param out Data output
* @param value0 first long value to write
* @throws IOException if an I/O error occurs
* @throws NullPointerException if output is null
*/
- public static void writeLongs(final @Nonnull DataOutput out, final long value0, final long value1) throws IOException {
+ public static void writeLongs(final @Nonnull DataOutput out, final long value0, final long value1)
+ throws IOException {
final int clen = WritableObjects.valueBytes(value1);
writeLong(out, value0, clen << 4);
WritableObjects.writeValue(out, value1, clen);
package org.opendaylight.yangtools.concepts;
import static org.junit.Assert.assertEquals;
+
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import java.io.IOException;