This class facilitates the parsing of strings of the form "protocol-x.y.z", where protocol is a string representing some namespace or qualifier (i.e., a file format name, like "kiji" in the string "kiji-1.1" representing a table layout JSON file), and x, y and z are integers. protocol, y and z are optional.
You can parse a string into a ProtocolVersion using the static {@link #parse}method. Its javadoc specifies further what strings constitute valid ProtocolVersions.
Version numbers are compared numerically starting at the major version number and moving to the right; each field is treated as a separate integer, not a decimal value. If minor or revision numbers are omitted, they are treated as zero.
The {@link #compareTo(ProtocolVersion)} function treats identical version numberswith different protocol names as different; foo-1.0
and bar-1.0
are not the same version number. ProtocolVersion instances will be sorted first by protocol name (alphabetically), then by version number.
The {@link #compareTo(ProtocolVersion)}, {@link #hashCode()}, and {@link #equals(Object)} methods will regard versions omitting trailing .0
's asequal. For example, foo-1
, foo-1.0
, and foo-1.0.0
are all equal. The {@link #toString()} method will return theexact string that was parsed; so equal objects may have unequal toString() representations. Use {@link #toCanonicalString()} to get the same string representationout of each.
ProtocolVersion instances are immutable.
|
|
|
|