Showing
1 changed file
with
44 additions
and
0 deletions
1 | +package org.onlab.onos.store.service; | ||
2 | + | ||
3 | +import java.util.Arrays; | ||
4 | + | ||
5 | +/** | ||
6 | + * Wrapper object that holds the object (as byte array) and its version. | ||
7 | + */ | ||
8 | +public class VersionedValue { | ||
9 | + | ||
10 | + private final byte[] value; | ||
11 | + private final long version; | ||
12 | + | ||
13 | + /** | ||
14 | + * Creates a new instance with the specified value and version. | ||
15 | + * @param value | ||
16 | + * @param version | ||
17 | + */ | ||
18 | + public VersionedValue(byte[] value, long version) { | ||
19 | + this.value = value; | ||
20 | + this.version = version; | ||
21 | + } | ||
22 | + | ||
23 | + /** | ||
24 | + * Returns the value. | ||
25 | + * @return value. | ||
26 | + */ | ||
27 | + public byte[] value() { | ||
28 | + return value; | ||
29 | + } | ||
30 | + | ||
31 | + /** | ||
32 | + * Returns the version. | ||
33 | + * @return version. | ||
34 | + */ | ||
35 | + public long version() { | ||
36 | + return version; | ||
37 | + } | ||
38 | + | ||
39 | + @Override | ||
40 | + public String toString() { | ||
41 | + return "VersionedValue [value=" + Arrays.toString(value) + ", version=" | ||
42 | + + version + "]"; | ||
43 | + } | ||
44 | +} |
-
Please register or login to post a comment