public final class Bin extends Object
Modifier and Type | Field and Description |
---|---|
String |
name
Bin name.
|
Value |
value
Bin value.
|
Constructor and Description |
---|
Bin(String name,
boolean value)
Constructor, specifying bin name and boolean value.
|
Bin(String name,
byte value)
Constructor, specifying bin name and byte value.
|
Bin(String name,
byte[] value)
Constructor, specifying bin name and byte array value.
|
Bin(String name,
byte[] value,
int offset,
int length)
Constructor, specifying bin name and byte array segment value.
|
Bin(String name,
double value)
Constructor, specifying bin name and double value.
|
Bin(String name,
float value)
Constructor, specifying bin name and float value.
|
Bin(String name,
int value)
Constructor, specifying bin name and integer value.
|
Bin(String name,
List<?> value)
Create bin with a list value.
|
Bin(String name,
long value)
Constructor, specifying bin name and long value.
|
Bin(String name,
Map<?,?> value)
Create bin with a map value.
|
Bin(String name,
Object value)
Constructor, specifying bin name and object value.
|
Bin(String name,
String value)
Constructor, specifying bin name and string value.
|
Bin(String name,
Value value)
Constructor, specifying bin name and value.
|
Modifier and Type | Method and Description |
---|---|
static Bin |
asBlob(String name,
Object value)
Create bin with a blob value.
|
static Bin |
asGeoJSON(String name,
String value)
Create bin with a GeoJSON value.
|
static Bin |
asNull(String name)
Create bin with a null value.
|
boolean |
equals(Object obj)
Compare Bin for equality.
|
int |
hashCode()
Return hash code for Bin.
|
String |
toString()
Return string representation of bin.
|
public final String name
public final Value value
public Bin(String name, String value)
name
- bin name, current limit is 14 charactersvalue
- bin valuepublic Bin(String name, byte[] value)
name
- bin name, current limit is 14 charactersvalue
- bin valuepublic Bin(String name, byte[] value, int offset, int length)
name
- bin name, current limit is 14 charactersvalue
- byte array valueoffset
- byte array segment offsetlength
- byte array segment lengthpublic Bin(String name, byte value)
name
- bin name, current limit is 14 charactersvalue
- bin valuepublic Bin(String name, int value)
name
- bin name, current limit is 14 charactersvalue
- bin valuepublic Bin(String name, long value)
name
- bin name, current limit is 14 charactersvalue
- bin valuepublic Bin(String name, double value)
Value.UseDoubleType
to true;
If your cluster does not support floating point, the value is converted to long bits.
On reads, it's important to call Record.getDouble(String name)
to indicate that the long returned by the server should be converted back to a double.
If the same bin name holds different types for different records, then this constructor
should not be used because there is no way to know when reading if the long should be
converted to a double. Instead, use Bin(String name, Object value)
which converts
the double to a java serialized blob.
double value = 22.7; Bin bin = new Bin("mybin", (Object) value);This is slower and not portable to other languages, but the double type is preserved, so a Double will be returned without knowing if a conversion should be made.
For servers configured as "single-bin", enter a null or empty name.
name
- bin name, current limit is 14 charactersvalue
- bin valuepublic Bin(String name, float value)
Value.UseDoubleType
to true;
If your cluster does not support floating point, the value is converted to long bits.
On reads, it's important to call Record.getFloat(String name)
to indicate that the long returned by the server should be converted back to a float.
If the same bin name holds different types for different records, then this constructor
should not be used because there is no way to know when reading if the long should be
converted to a float. Instead, use Bin(String name, Object value)
which converts
the float to a java serialized blob.
float value = 11.7; Bin bin = new Bin("mybin", (Object) value);This is slower and not portable to other languages, but the float type is preserved, so a Float will be returned without knowing if a conversion should be made.
For servers configured as "single-bin", enter a null or empty name.
name
- bin name, current limit is 14 charactersvalue
- bin valuepublic Bin(String name, boolean value)
name
- bin name, current limit is 14 charactersvalue
- bin valuepublic Bin(String name, List<?> value)
If connecting to Aerospike 2 servers, use the following instead:
Bin bin = new Bin(name, (Object)list);
For servers configured as "single-bin", enter a null or empty name.name
- bin name, current limit is 14 charactersvalue
- bin valuepublic Bin(String name, Map<?,?> value)
name
- bin name, current limit is 14 charactersvalue
- bin valuepublic Bin(String name, Value value)
name
- bin name, current limit is 14 charactersvalue
- bin valuepublic Bin(String name, Object value)
For servers configured as "single-bin", enter a null or empty name.
name
- bin name, current limit is 14 charactersvalue
- bin valuepublic static Bin asBlob(String name, Object value)
For servers configured as "single-bin", enter a null or empty name.
name
- bin name, current limit is 14 charactersvalue
- bin valuepublic static Bin asNull(String name)
name
- bin name, current limit is 14 characterspublic static Bin asGeoJSON(String name, String value)
name
- bin name, current limit is 14 charactersvalue
- bin valuepublic String toString()
public boolean equals(Object obj)
Copyright ? 2012–2018 Aerospike, Inc. All rights reserved.