Type-Specific Getter Methods
The interface JCoStructure contains type-specific getter methods such as getString() for the data type string. Applications normally use the appropriate getter method, You can of course use another getter method: SAP JCo then tries to convert the field content to a relevant data type. If this conversion is unsuccessful (for example, if a string field contains the value “abcd”, and you call getDate() ), an exception is thrown.
The table below lists all the type-specific getter methods. The method getValue() can be used to call the content of a field generically. This method returns a Java object.
JCo Type Code |
JCo Access Method
|
JCoMetadata.TYPE_INT1 |
int getInt() |
|
JCoMetadata.TYPE_INT2 |
int getInt() |
|
JCoMetadata.TYPE_INT |
int getInt() |
|
JCoMetadata.TYPE_CHAR |
String getString() |
|
JCoMetadata.TYPE_NUM |
String getString() |
|
JCoMetadata.TYPE_BCD |
BigDecimal getBigDecimal() |
|
JCoMetadata.TYPE_DATE |
Date getDate() |
|
JCoMetadata.TYPE_TIME |
Date getTime() |
|
JCoMetadata.TYPE_FLOAT |
double getDouble() |
|
JCoMetadatav_BYTE |
byte[ ] getByteArray() |
|
JCoMetadata.TYPE_STRING |
String getString() |
|
JCoMetadata.TYPE_XSTRING |
byte[ ] getByteArray() |
|
JCoMetadata.TYPE_DECF16 |
BigDecimal getBigDecimal() |
|
JCoMetadata.TYPE_DECF34 |
BigDecimal getBigDecimal() |