Get Scalar

Convenience Methods

Declaration

scalar_type getScalar_type(
    java.lang.String fieldName,
    int fieldId)
  throws TibrvException
scalar_type getAsScalar_type(
    java.lang.String fieldName,
    int fieldId)
  throws TibrvException

Purpose

Get the value of a field as a scalar value.

Remarks

Each convenience method in this family retrieves a field and extracts its data. If the field’s type (as it exists) does not match the type of the convenience method, then the gettype method throws an exception; in contrast, the getAstype method attempts to convert the data (see Decoding and Type Conversion, and Wire Format to Java Datatype Conversion Matrix). If conversion is not possible, the method throws an exception with status code TibrvStatus.CONVERSION_FAILED.

Parameter

Description

fieldName

Get a field with this name.

fieldId

Get the field with this identifier.

Method Name

Field Type

Java Type

Type Description

getBoolean

getAsBoolean

TibrvMsg.BOOL

boolean

boolean

getFloat

getAsFloat

TibrvMsg.F32

float

32-bit floating point

getDouble

getAsDouble

TibrvMsg.F64

double

64-bit floating point

getByte

getAsByte

TibrvMsg.I8

byte

8-bit integer

getShort

getAsShort

TibrvMsg.I16

short

16-bit integer

getInt

getAsInt

TibrvMsg.I32

int

32-bit integer

getLong

getAsLong

TibrvMsg.I64

long

64-bit integer