@API(value=MAINTAINED) public class TupleRange extends Object
Tuple
endpoints.Modifier and Type | Class and Description |
---|---|
static class |
TupleRange.ByteStringBoundException
Exception thrown when range endpoint is not consistent with
CONTINUATION endpoint type. |
Modifier and Type | Field and Description |
---|---|
static TupleRange |
ALL |
Constructor and Description |
---|
TupleRange(Tuple low,
Tuple high,
EndpointType lowEndpoint,
EndpointType highEndpoint) |
Modifier and Type | Method and Description |
---|---|
static TupleRange |
allOf(Tuple prefix)
Create a
TupleRange over all keys beginning with a given Tuple . |
static TupleRange |
between(Tuple low,
Tuple high)
Create a
TupleRange over all keys between the given Tuple s. |
boolean |
equals(Object o) |
Tuple |
getHigh() |
EndpointType |
getHighEndpoint() |
Tuple |
getLow() |
EndpointType |
getLowEndpoint() |
int |
hashCode() |
boolean |
isEquals() |
static TupleRange |
prefixedBy(String prefixString)
Create a
TupleRange over all keys prefixed by some String . |
TupleRange |
prepend(Tuple beginning)
Create a
TupleRange over the same keys as this range but prepended
by the supplied Tuple . |
Range |
toRange()
Convert into a FoundationDB
Range . |
static Range |
toRange(byte[] lowBytes,
byte[] highBytes,
EndpointType lowEndpoint,
EndpointType highEndpoint)
Convert a pair of endpoints into a FoundationDB
Range . |
Range |
toRange(Subspace subspace)
Convert into a FoundationDB
Range . |
String |
toString() |
protected static String |
tupleToString(Tuple t) |
public static final TupleRange ALL
public TupleRange(@Nullable Tuple low, @Nullable Tuple high, @Nonnull EndpointType lowEndpoint, @Nonnull EndpointType highEndpoint)
@Nonnull public EndpointType getLowEndpoint()
@Nonnull public EndpointType getHighEndpoint()
public boolean isEquals()
@Nonnull public TupleRange prepend(@Nonnull Tuple beginning)
TupleRange
over the same keys as this range but prepended
by the supplied Tuple
. For example, if this range is over all Tuple
s
from ("a", 3)
exclusive to ("b", 4)
inclusive and one
calls this method with (0, null)
as the argument, this will create a
range from (0, null, "a", 3)
exclusive to (0, null, "b", 4)
inclusive.beginning
- a Tuple
to prepend to the beginning of this rangeTupleRange
over all keys in this range but prepended with beginning
@Nonnull public static TupleRange allOf(@Nullable Tuple prefix)
TupleRange
over all keys beginning with a given Tuple
.
This is a shortcut for creating a TupleRange
with prefix
as both the low- and high-endpoint and setting both endpoint types to
RANGE_INCLUSIVE
.prefix
- the Tuple
all keys in the returned range should begin withTupleRange
corresponding to keys prefixed by prefix
public static TupleRange between(@Nullable Tuple low, @Nullable Tuple high)
TupleRange
over all keys between the given Tuple
s.low
- the inclusive start of the rangehigh
- the exclusive end of the rangeTupleRange
between start
and end
@Nonnull public static TupleRange prefixedBy(@Nonnull String prefixString)
TupleRange
over all keys prefixed by some String
. This
is a shortcut for creating a TupleRange
where both the low- and high-endpoints
are Tuple
s containing a single String
where both the low
and high endpoint types are PREFIX_STRING
.prefixString
- the string that the keys in the returned range will have as a prefixTupleRange
corresponding to keys prefixed by prefixString
@Nonnull public Range toRange()
Range
. This behaves just like the version of
toRange()
that takes a Subspace
, but this version does not
prefix the resulting range with anything. If either endpoint is null
, then
the null
endpoints will be replaced with byte
arrays representing
the beginning or ending of the user-readable keys in FoundationDB (that is, it will not
include the system keyspace).Range
over the same keys as this TupleRange
@Nonnull public Range toRange(@Nonnull Subspace subspace)
Range
. This adjusts the endpoints of this TupleRange
and
creates a Range
object that spans over the same range of keys. This range can be passed
to Trasaction.getRange()
, for example.
As with all other ranges in FoundationDB, the resulting range will include its beginning endpoint
but exclude its ending endpoint. The range produced will be prefixed by the Subspace
provided.@Nonnull public static Range toRange(@Nullable byte[] lowBytes, @Nullable byte[] highBytes, @Nonnull EndpointType lowEndpoint, @Nonnull EndpointType highEndpoint)
Range
. If both lowBytes
and highBytes
could be unpacked into Tuple
s, this would be equivalent
to unpacking them, creating a TupleRange
object out of them, and then calling
toRange()
on the resulting TupleRange
.lowBytes
- the beginning of the rangehighBytes
- the end of the rangelowEndpoint
- the type (inclusive, exclusive, etc.) of the low endpointhighEndpoint
- the type (inclusive, exclusive, etc.) of the high endpointRange
over the same keys as the provided parameters