public abstract class Exp extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Exp.Type
Expression type.
|
Modifier and Type | Field and Description |
---|---|
static int |
MODIFY |
Constructor and Description |
---|
Exp() |
Modifier and Type | Method and Description |
---|---|
static Exp |
and(Exp... exps)
Create "and" (&&) operator that applies to a variable number of expressions.
|
static Exp |
bin(String name,
Exp.Type type)
Create bin expression of specified type.
|
static Exp |
binExists(String name)
Create expression that returns if bin of specified name exists.
|
static Exp |
binType(String name)
Create expression that returns bin's integer particle type.
|
static Exp |
blobBin(String name)
Create byte[] bin expression.
|
static Expression |
build(Exp exp)
Create final expression that contains packed byte instructions used in the wire protocol.
|
static Exp |
deviceSize()
Create expression that returns record size on disk.
|
static Exp |
digestModulo(int mod)
Create expression that returns record digest modulo as integer.
|
static Exp |
eq(Exp left,
Exp right)
Create equal (==) expression.
|
static Exp |
floatBin(String name)
Create 64 bit float bin expression.
|
static Exp |
ge(Exp left,
Exp right)
Create greater than or equal (>=) operation.
|
static Exp |
geo(String val)
Create geospatial json string value.
|
static Exp |
geoBin(String name)
Create geospatial bin expression.
|
static Exp |
geoCompare(Exp left,
Exp right)
Create compare geospatial operation.
|
static Exp |
gt(Exp left,
Exp right)
Create greater than (>) operation.
|
static Exp |
hllBin(String name)
Create hll bin expression.
|
static Exp |
intBin(String name)
Create 64 bit integer bin expression.
|
static Exp |
isTombstone()
Create expression that returns if record has been deleted and is still in tombstone state.
|
static Exp |
key(Exp.Type type)
Create record key expression of specified type.
|
static Exp |
keyExists()
Create expression that returns if the primary key is stored in the record meta data
as a boolean expression.
|
static Exp |
lastUpdate()
Create expression that returns record last update time expressed as 64 bit integer
nanoseconds since 1970-01-01 epoch.
|
static Exp |
le(Exp left,
Exp right)
Create less than or equals (<=) operation.
|
static Exp |
listBin(String name)
Create list bin expression.
|
static Exp |
lt(Exp left,
Exp right)
Create less than (<) operation.
|
static Exp |
mapBin(String name)
Create map bin expression.
|
static Exp |
memorySize()
Create expression that returns record size in memory.
|
static Exp |
ne(Exp left,
Exp right)
Create not equal (!=) expression
|
static Exp |
nil()
Create nil value.
|
static Exp |
not(Exp exp)
Create "not" operator expression.
|
static Exp |
or(Exp... exps)
Create "or" (||) operator that applies to a variable number of expressions.
|
abstract void |
pack(com.aerospike.client.util.Packer packer) |
static Exp |
regexCompare(String regex,
int flags,
Exp bin)
Create expression that performs a regex match on a string bin or string value expression.
|
static Exp |
setName()
Create expression that returns record set name string.
|
static Exp |
sinceUpdate()
Create expression that returns milliseconds since the record was last updated.
|
static Exp |
stringBin(String name)
Create string bin expression.
|
static Exp |
ttl()
Create expression that returns record expiration time (time to live) in integer seconds.
|
static Exp |
val(boolean val)
Create boolean value.
|
static Exp |
val(byte[] val)
Create blob byte[] value.
|
static Exp |
val(Calendar val)
Create Calendar value expressed in nanoseconds since 1970-01-01 epoch as 64 bit integer.
|
static Exp |
val(double val)
Create 64 bit floating point value.
|
static Exp |
val(List<?> list)
Create list value.
|
static Exp |
val(long val)
Create 64 bit integer value.
|
static Exp |
val(Map<?,?> map)
Create map value.
|
static Exp |
val(String val)
Create string value.
|
static Exp |
voidTime()
Create expression that returns record expiration time expressed as 64 bit integer
nanoseconds since 1970-01-01 epoch.
|
public static final int MODIFY
public static Expression build(Exp exp)
public static Exp key(Exp.Type type)
// Integer record key >= 100000
Exp.ge(Exp.key(Type.INT), Exp.val(100000))
public static Exp keyExists()
Policy.sendKey
is true on record write. This expression usually evaluates quickly because record
meta data is cached in memory.
// Key exists in record meta data
Exp.keyExists()
public static Exp bin(String name, Exp.Type type)
// String bin "a" == "views"
Exp.eq(Exp.bin("a", Type.STRING), Exp.val("views"))
public static Exp intBin(String name)
// Integer bin "a" == 200
Exp.eq(Exp.intBin("a"), Exp.val(200))
public static Exp floatBin(String name)
// Float bin "a" >= 1.5
Exp.ge(Exp.floatBin("a"), Exp.val(1.5))
public static Exp stringBin(String name)
// String bin "a" == "views"
Exp.eq(Exp.stringBin("a"), Exp.val("views"))
public static Exp blobBin(String name)
// Blob bin "a" == [1,2,3]
Exp.eq(Exp.blobBin("a"), Exp.val(new byte[] {1, 2, 3}))
public static Exp geoBin(String name)
// Geo bin "a" == region
String region = "{ \"type\": \"AeroCircle\", \"coordinates\": [[-122.0, 37.5], 50000.0] }";
Exp.geoCompare(Exp.geoBin("loc"), Exp.val(region))
public static Exp listBin(String name)
// Bin a[2] == 3
Exp.eq(ListExp.getByIndex(ListReturnType.VALUE, Type.INT, Exp.val(2), Exp.listBin("a")), Exp.val(3))
public static Exp mapBin(String name)
// Bin a["key"] == "value"
Exp.eq(
MapExp.getByKey(MapReturnType.VALUE, Type.STRING, Exp.val("key"), Exp.mapBin("a")),
Exp.val("value"));
public static Exp hllBin(String name)
// HLL bin "a" count > 7
Exp.gt(HLLExp.getCount(Exp.hllBin("a")), Exp.val(7))
public static Exp binExists(String name)
// Bin "a" exists in record
Exp.binExists("a")
public static Exp binType(String name)
ParticleType
.
// Bin "a" particle type is a list
Exp.eq(Exp.binType("a"), Exp.val(ParticleType.LIST))
public static Exp setName()
// Record set name == "myset"
Exp.eq(Exp.setName(), Exp.val("myset"))
public static Exp deviceSize()
// Record device size >= 100 KB
Exp.ge(Exp.deviceSize(), Exp.val(100 * 1024))
public static Exp memorySize()
This method requires Aerospike Server version >= 5.3.0.
// Record memory size >= 100 KB
Exp.ge(Exp.memorySize(), Exp.val(100 * 1024))
public static Exp lastUpdate()
// Record last update time >= 2020-01-15
Exp.ge(Exp.lastUpdate(), Exp.val(new GregorianCalendar(2020, 0, 15)))
public static Exp sinceUpdate()
// Record last updated more than 2 hours ago
Exp.gt(Exp.sinceUpdate(), Exp.val(2 * 60 * 60 * 1000))
public static Exp voidTime()
// Record expires on 2021-01-01
Exp.and(
Exp.ge(Exp.voidTime(), Exp.val(new GregorianCalendar(2021, 0, 1))),
Exp.lt(Exp.voidTime(), Exp.val(new GregorianCalendar(2021, 0, 2))))
public static Exp ttl()
// Record expires in less than 1 hour
Exp.lt(Exp.ttl(), Exp.val(60 * 60))
public static Exp isTombstone()
// Deleted records that are in tombstone state.
Exp.isTombstone()
public static Exp digestModulo(int mod)
// Records that have digest(key) % 3 == 1
Exp.eq(Exp.digestModulo(3), Exp.val(1))
public static Exp regexCompare(String regex, int flags, Exp bin)
// Select string bin "a" that starts with "prefix" and ends with "suffix".
// Ignore case and do not match newline.
Exp.regexCompare("prefix.*suffix", RegexFlag.ICASE | RegexFlag.NEWLINE, Exp.stringBin("a"))
regex
- regular expression stringflags
- regular expression bit flags. See RegexFlag
bin
- string bin or string value expressionpublic static Exp geoCompare(Exp left, Exp right)
// Query region within coordinates.
String region =
"{ " +
" \"type\": \"Polygon\", " +
" \"coordinates\": [ " +
" [[-122.500000, 37.000000],[-121.000000, 37.000000], " +
" [-121.000000, 38.080000],[-122.500000, 38.080000], " +
" [-122.500000, 37.000000]] " +
" ] " +
"}";
Exp.geoCompare(Exp.geoBin("a"), Exp.geo(region))
public static Exp val(boolean val)
public static Exp val(long val)
public static Exp val(Calendar val)
public static Exp val(double val)
public static Exp val(byte[] val)
public static Exp nil()
public static Exp not(Exp exp)
// ! (a == 0 || a == 10)
Exp.not(
Exp.or(
Exp.eq(Exp.intBin("a"), Exp.val(0)),
Exp.eq(Exp.intBin("a"), Exp.val(10))))
public static Exp and(Exp... exps)
// (a > 5 || a == 0) && b < 3
Exp.and(
Exp.or(
Exp.gt(Exp.intBin("a"), Exp.val(5)),
Exp.eq(Exp.intBin("a"), Exp.val(0))),
Exp.lt(Exp.intBin("b"), Exp.val(3)))
public static Exp or(Exp... exps)
// a == 0 || b == 0
Exp.or(
Exp.eq(Exp.intBin("a"), Exp.val(0)),
Exp.eq(Exp.intBin("b"), Exp.val(0)));
public static Exp eq(Exp left, Exp right)
// a == 11
Exp.eq(Exp.intBin("a"), Exp.val(11))
public static Exp ne(Exp left, Exp right)
// a != 13
Exp.ne(Exp.intBin("a"), Exp.val(13))
public static Exp gt(Exp left, Exp right)
// a > 8
Exp.gt(Exp.intBin("a"), Exp.val(8))
public static Exp ge(Exp left, Exp right)
// a >= 88
Exp.ge(Exp.intBin("a"), Exp.val(88))
public static Exp lt(Exp left, Exp right)
// a < 1000
Exp.lt(Exp.intBin("a"), Exp.val(1000))
public static Exp le(Exp left, Exp right)
// a <= 1
Exp.le(Exp.intBin("a"), Exp.val(1))
public abstract void pack(com.aerospike.client.util.Packer packer)
Copyright © 2012–2020 Aerospike, Inc. All rights reserved.