@@ -0,0 +1,2818 @@
+package org.infinispan.protostream;%0A%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.util.Properties;%0A%0A/**%0A * Contains version information about this ProtoStream release.%0A *%0A * @author anistor@redhat.com%0A * @since 4.2%0A */%0Apublic final class Version implements Comparable%3CVersion%3E %7B%0A%0A   private static final Version VERSION = getArtifactVersion();%0A%0A   /**%0A    * We try to obtain the Maven pom.properties of the artifact and get the build version from there.%0A    */%0A   private static Version getArtifactVersion() %7B%0A      int major = 0;%0A      int minor = 0;%0A      int patchLevel = 0;%0A%0A      InputStream res = Version.class.getResourceAsStream(%22/META-INF/maven/org.infinispan.protostream/protostream/pom.properties%22);%0A      if (res != null) %7B%0A         try %7B%0A            Properties pomProps = new Properties();%0A            pomProps.load(res);%0A            String version = pomProps.getProperty(%22version%22, %220.0.0-UNKNOWN%22);%0A            String%5B%5D versionParts = version.split(%22%5B.%5C%5C-%5D%22);%0A            major = Integer.parseInt(versionParts%5B0%5D);%0A            minor = Integer.parseInt(versionParts%5B1%5D);%0A            patchLevel = Integer.parseInt(versionParts%5B2%5D);%0A         %7D catch (IOException %7C NumberFormatException %7C ArrayIndexOutOfBoundsException e) %7B%0A            // ignored%0A         %7D%0A      %7D%0A%0A      return new Version(major, minor, patchLevel);%0A   %7D%0A%0A   public static Version getVersion() %7B%0A      return VERSION;%0A   %7D%0A%0A   public static void main(String%5B%5D args) %7B%0A      System.out.println(%22ProtoStream version %22 + getVersion());%0A   %7D%0A%0A   private final int major;%0A   private final int minor;%0A   private final int patchLevel;%0A   private final String versionString;%0A%0A   public Version(int major, int minor, int patchLevel) %7B%0A      this.major = major;%0A      this.minor = minor;%0A      this.patchLevel = patchLevel;%0A      versionString = major + %22.%22 + minor + %22.%22 + patchLevel;%0A   %7D%0A%0A   public int getMajor() %7B%0A      return major;%0A   %7D%0A%0A   public int getMinor() %7B%0A      return minor;%0A   %7D%0A%0A   public int getPatchLevel() %7B%0A      return patchLevel;%0A   %7D%0A%0A   @Override%0A   public String toString() %7B%0A      return versionString;%0A   %7D%0A%0A   @Override%0A   public boolean equals(Object obj) %7B%0A      if (obj == this) %7B%0A         return true;%0A      %7D%0A      if (obj == null %7C%7C obj.getClass() != getClass()) %7B%0A         return false;%0A      %7D%0A      Version other = (Version) obj;%0A      return other.major == major && other.minor == minor && other.patchLevel == patchLevel;%0A   %7D%0A%0A   @Override%0A   public int hashCode() %7B%0A      return 31 * (31 * major + minor) + patchLevel;%0A   %7D%0A%0A   @Override%0A   public int compareTo(Version other) %7B%0A      int d = major - other.major;%0A      if (d == 0) %7B%0A         d = minor - other.minor;%0A         if (d == 0) %7B%0A            d = patchLevel - other.patchLevel;%0A         %7D%0A      %7D%0A      return d;%0A   %7D%0A%7D%0A

Add a Version class