FDBRecordVersion implements Comparable<FDBRecordVersion> { @Nonnull public static FDBRecordVersion fromVersionstamp(@Nonnull Versionstamp versionstamp) { return fromVersionstamp(versionstamp, true); } @Nonnull private  FDBRecordVersion(boolean complete, @Nonnull byte[] versionBytes, boolean copy); @Nonnull static FDBRecordVersion complete(@Nonnull byte[] globalVersion, int localVersion); @Nonnull static FDBRecordVersion complete(@Nonnull byte[] versionBytes); @Nonnull static FDBRecordVersion complete(@Nonnull byte[] versionBytes, boolean copy); @Nonnull static FDBRecordVersion incomplete(int localVersion); @Nonnull static FDBRecordVersion fromBytes(@Nonnull byte[] versionBytes); @Nonnull static FDBRecordVersion fromBytes(@Nonnull byte[] versionBytes, boolean copy); @Nonnull static FDBRecordVersion fromVersionstamp(@Nonnull Versionstamp versionstamp); @Nonnull static FDBRecordVersion fromVersionstamp(@Nonnull Versionstamp versionstamp, boolean copy); @Nonnull static FDBRecordVersion firstInDBVersion(long dbVersion); static FDBRecordVersion firstInGlobalVersion(@Nonnull byte[] globalVersion); static FDBRecordVersion lastInDBVersion(long dbVersion); static FDBRecordVersion lastInGlobalVersion(@Nonnull byte[] globalVersion); @Nonnull Versionstamp toVersionstamp(); @Nonnull Versionstamp toVersionstamp(boolean copy); @Nonnull byte[] toBytes(); @Nonnull @SpotBugsSuppressWarnings(value = "EI", justification = "option is explicitly set to do this") byte[] toBytes(boolean copy); @Nonnull ByteBuffer writeTo(@Nonnull ByteBuffer buffer); int writeTo(@Nonnull byte[] bytes); int writeTo(@Nonnull byte[] bytes, int offset); boolean isComplete(); int getLocalVersion(); @Nonnull @SpotBugsSuppressWarnings(value = "EI", justification = "not mutated later") byte[] getGlobalVersion(); long getDBVersion(); @Nonnull FDBRecordVersion next(); @Nonnull FDBRecordVersion prev(); @Nonnull FDBRecordVersion withCommittedVersion(@Nullable byte[] committedVersion); @Override boolean equals(Object o); @Override int compareTo(@Nonnull FDBRecordVersion other); @Override int hashCode(); @Override @Nonnull String toString(); static final int GLOBAL_VERSION_LENGTH; static final int VERSION_LENGTH; static final FDBRecordVersion MIN_VERSION; static final FDBRecordVersion MAX_VERSION; }
@Test public void fromVersionStamp() { Versionstamp stamp1 = Versionstamp.complete(VERSION_BYTES_TWO, 100); assertEquals(FDBRecordVersion.complete(VERSION_BYTES_TWO, 100), FDBRecordVersion.fromVersionstamp(stamp1)); Versionstamp stamp2 = Versionstamp.incomplete(42); assertEquals(FDBRecordVersion.incomplete(42), FDBRecordVersion.fromVersionstamp(stamp2)); }