Class FlexBuffers.Reference
- java.lang.Object
-
- io.objectbox.flatbuffers.FlexBuffers.Reference
-
- Enclosing class:
- FlexBuffers
public static class FlexBuffers.Reference extends java.lang.Object
Represents an generic element in the buffer.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FlexBuffers.Blob
asBlob()
Returns element as aFlexBuffers.Blob
boolean
asBoolean()
Returns element as a booleandouble
asFloat()
Returns element as 64-bit integer.int
asInt()
Returns element as 32-bit integer.FlexBuffers.Key
asKey()
Returns element as aFlexBuffers.Key
long
asLong()
Returns element as 64-bit integer.FlexBuffers.Map
asMap()
Returns element as aFlexBuffers.Map
java.lang.String
asString()
Returns element as a `String`long
asUInt()
Returns element as unsigned 64-bit integer.FlexBuffers.Vector
asVector()
Returns element as aFlexBuffers.Vector
int
getType()
Return element typeboolean
isBlob()
Checks whether the element type is a blobboolean
isBoolean()
Checks whether the element is boolean typeboolean
isFloat()
Checks whether the element type is floatboolean
isInt()
Checks whether the element type is signed integerboolean
isIntOrUInt()
Checks whether the element type is signed or unsigned integersboolean
isKey()
Checks whether the element type is keyboolean
isMap()
Checks whether the element type is a mapboolean
isNull()
Checks whether the element is null typeboolean
isNumeric()
Checks whether the element type is numeric (signed/unsigned integers and floats)boolean
isString()
Checks whether the element type is stringboolean
isTypedVector()
Checks whether the element type is typed vectorboolean
isUInt()
Checks whether the element type is signed integerboolean
isVector()
Checks whether the element type is vectorjava.lang.String
toString()
Returns text representation of the element (JSON)
-
-
-
Method Detail
-
getType
public int getType()
Return element type- Returns:
- element type as integer
-
isNull
public boolean isNull()
Checks whether the element is null type- Returns:
- true if null type
-
isBoolean
public boolean isBoolean()
Checks whether the element is boolean type- Returns:
- true if boolean type
-
isNumeric
public boolean isNumeric()
Checks whether the element type is numeric (signed/unsigned integers and floats)- Returns:
- true if numeric type
-
isIntOrUInt
public boolean isIntOrUInt()
Checks whether the element type is signed or unsigned integers- Returns:
- true if an integer type
-
isFloat
public boolean isFloat()
Checks whether the element type is float- Returns:
- true if a float type
-
isInt
public boolean isInt()
Checks whether the element type is signed integer- Returns:
- true if a signed integer type
-
isUInt
public boolean isUInt()
Checks whether the element type is signed integer- Returns:
- true if a signed integer type
-
isString
public boolean isString()
Checks whether the element type is string- Returns:
- true if a string type
-
isKey
public boolean isKey()
Checks whether the element type is key- Returns:
- true if a key type
-
isVector
public boolean isVector()
Checks whether the element type is vector- Returns:
- true if a vector type
-
isTypedVector
public boolean isTypedVector()
Checks whether the element type is typed vector- Returns:
- true if a typed vector type
-
isMap
public boolean isMap()
Checks whether the element type is a map- Returns:
- true if a map type
-
isBlob
public boolean isBlob()
Checks whether the element type is a blob- Returns:
- true if a blob type
-
asInt
public int asInt()
Returns element as 32-bit integer.For vector element, it will return size of the vector
For String element, it will type to be parsed as integer
Unsigned elements will become negative
Float elements will be casted to integer
- Returns:
- 32-bit integer or 0 if fail to convert element to integer.
-
asUInt
public long asUInt()
Returns element as unsigned 64-bit integer.For vector element, it will return size of the vector
For String element, it will type to be parsed as integer
Negative signed elements will become unsigned counterpart
Float elements will be casted to integer
- Returns:
- 64-bit integer or 0 if fail to convert element to integer.
-
asLong
public long asLong()
Returns element as 64-bit integer.For vector element, it will return size of the vector
For String element, it will type to be parsed as integer
Unsigned elements will become negative
Float elements will be casted to integer
- Returns:
- 64-bit integer or 0 if fail to convert element to long.
-
asFloat
public double asFloat()
Returns element as 64-bit integer.For vector element, it will return size of the vector
For String element, it will type to be parsed as integer
- Returns:
- 64-bit integer or 0 if fail to convert element to long.
-
asKey
public FlexBuffers.Key asKey()
Returns element as aFlexBuffers.Key
- Returns:
- key or
FlexBuffers.Key.empty()
if element is not a key
-
asString
public java.lang.String asString()
Returns element as a `String`- Returns:
- element as `String` or empty `String` if fail
-
asMap
public FlexBuffers.Map asMap()
Returns element as aFlexBuffers.Map
- Returns:
- element as
FlexBuffers.Map
or emptyFlexBuffers.Map
if fail
-
asVector
public FlexBuffers.Vector asVector()
Returns element as aFlexBuffers.Vector
- Returns:
- element as
FlexBuffers.Vector
or emptyFlexBuffers.Vector
if fail
-
asBlob
public FlexBuffers.Blob asBlob()
Returns element as aFlexBuffers.Blob
- Returns:
- element as
FlexBuffers.Blob
or emptyFlexBuffers.Blob
if fail
-
asBoolean
public boolean asBoolean()
Returns element as a booleanIf element type is not boolean, it will be casted to integer and compared against 0
- Returns:
- element as boolean
-
toString
public java.lang.String toString()
Returns text representation of the element (JSON)- Overrides:
toString
in classjava.lang.Object
- Returns:
- String containing text representation of the element
-
-