public final class FormatVersion extends Object implements Comparable<FormatVersion>
canRead(org.apache.jackrabbit.oak.plugins.document.FormatVersion) the current or
older versions.| Modifier and Type | Method and Description |
|---|---|
boolean |
canRead(FormatVersion other)
Returns
true if this version can read data written by the
other version. |
int |
compareTo(@NotNull FormatVersion other) |
boolean |
equals(Object obj) |
String |
toString() |
static FormatVersion |
valueOf(String s)
Returns a format version for the given String representation.
|
static Iterable<FormatVersion> |
values() |
static @NotNull FormatVersion |
versionOf(@NotNull DocumentStore store)
Reads the
FormatVersion from the given store. |
boolean |
writeTo(@NotNull DocumentStore store)
Writes this version to the given document store.
|
public static Iterable<FormatVersion> values()
public boolean canRead(FormatVersion other)
true if this version can read data written by the
other version.other - the version the data was written in.true if this version can read, false otherwise.@NotNull public static @NotNull FormatVersion versionOf(@NotNull @NotNull DocumentStore store) throws DocumentStoreException
FormatVersion from the given store. This method
returns V0 if the store currently does not have a
version set.store - the store to read from.DocumentStoreException - if an error occurs while reading from the
store.public boolean writeTo(@NotNull
@NotNull DocumentStore store)
throws DocumentStoreException
DocumentStoreException if the version change is
considered incompatible or cannot be applied for some other reason. This
includes:
store - the document store.true if the version in the store was updated,
false otherwise. This method will also return false
if the version in the store equals this version and now update was
required.DocumentStoreException - if the write operation fails. Reasons
include: 1) an attempt to downgrade the existing version, 2) there
are active cluster nodes using an existing version, 3) the version
was changed concurrently.public static FormatVersion valueOf(String s) throws IllegalArgumentException
s - the String representation of a format version.IllegalArgumentException - if the string is malformed.public int compareTo(@NotNull
@NotNull FormatVersion other)
compareTo in interface Comparable<FormatVersion>Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.