public final class Variant extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Variant.ObjectField
A field in a Variant object.
|
static class |
Variant.Type
The value type of Variant value.
|
| Constructor and Description |
|---|
Variant(byte[] value,
byte[] metadata) |
Variant(byte[] value,
int valuePos,
int valueLength,
byte[] metadata,
int metadataPos,
int metadataLength) |
Variant(ByteBuffer value,
ByteBuffer metadata) |
| Modifier and Type | Method and Description |
|---|---|
ByteBuffer |
getBinary() |
boolean |
getBoolean() |
byte |
getByte() |
BigDecimal |
getDecimal() |
double |
getDouble() |
Variant |
getElementAtIndex(int index)
Returns the array element Variant value at the `index` slot.
|
Variant.ObjectField |
getFieldAtIndex(int idx)
Returns the field at index idx, lexicographically ordered.
|
Variant |
getFieldByKey(String key)
Returns the object field Variant value whose key is equal to `key`.
|
float |
getFloat() |
int |
getInt() |
long |
getLong() |
ByteBuffer |
getMetadataBuffer() |
short |
getShort() |
String |
getString() |
Variant.Type |
getType() |
UUID |
getUUID() |
ByteBuffer |
getValueBuffer() |
int |
numArrayElements() |
int |
numObjectElements() |
public Variant(byte[] value,
byte[] metadata)
public Variant(byte[] value,
int valuePos,
int valueLength,
byte[] metadata,
int metadataPos,
int metadataLength)
public Variant(ByteBuffer value, ByteBuffer metadata)
public ByteBuffer getValueBuffer()
public ByteBuffer getMetadataBuffer()
public boolean getBoolean()
public byte getByte()
public short getShort()
public int getInt()
public long getLong()
public double getDouble()
public BigDecimal getDecimal()
public float getFloat()
public ByteBuffer getBinary()
public UUID getUUID()
public String getString()
public Variant.Type getType()
public int numObjectElements()
IllegalArgumentException - if `getType()` does not return `Type.OBJECT`public Variant getFieldByKey(String key)
key - the key to look upIllegalArgumentException - if `getType()` does not return `Type.OBJECT`public Variant.ObjectField getFieldAtIndex(int idx)
idx - the index to look upIllegalArgumentException - if `getType()` does not return `Type.OBJECT`public int numArrayElements()
IllegalArgumentException - if `getType()` does not return `Type.ARRAY`public Variant getElementAtIndex(int index)
index - the index of the array element to getIllegalArgumentException - if `getType()` does not return `Type.ARRAY`Copyright © 2024 The Apache Software Foundation. All rights reserved.