Interface JCoRecord
- All Superinterfaces:
Cloneable
,Iterable<JCoField>
,Serializable
- All Known Subinterfaces:
JCoAbapObject
,JCoParameterList
,JCoRequest
,JCoResponse
,JCoStructure
,JCoTable
Getter-Method / Datatype | JCoMetaData.TYPE_CHAR | JCoMetaData.TYPE_INT1 | JCoMetaData.TYPE_INT2 | JCoMetaData.TYPE_INT | JCoMetaData.TYPE_INT8 | JCoMetaData.TYPE_UTCLONG | JCoMetaData.TYPE_NUM | JCoMetaData.TYPE_BCD | JCoMetaData.TYPE_FLOAT | JCoMetaData.TYPE_BYTE | JCoMetaData.TYPE_DATE | JCoMetaData.TYPE_TIME | JCoMetaData.TYPE_STRING | JCoMetaData.TYPE_XSTRING | JCoMetaData.TYPE_DECF16 | JCoMetaData.TYPE_DECF34 | JCoMetaData.TYPE_STRUCTURE | JCoMetaData.TYPE_TABLE | JCoMetaData.TYPE_ABAPOBJECT |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
java.lang.Object getValue() | String | Integer | Integer | Integer | Long | String | String | BigDecimal | Double | byte[] | Date | Date | String | byte[] | BigDecimal | BigDecimal | JCoStructure | JCoTable | JCoAbapObject |
String getString() | String | String | String | String | String | String | String | String | String | String (hexadecimal) | String | String | String | String (hexadecimal) | String | String | String (structure name) | String (table name) | String (class name) |
char getChar() | char | --- | --- | --- | --- | --- | char | --- | --- | --- | --- | --- | char | --- | --- | --- | --- | --- | --- |
char[] getCharArray() | char[] | --- | --- | --- | --- | --- | char[] | --- | --- | --- | char[] | char[] | char[] | --- | --- | --- | --- | --- | --- |
byte getByte() | byte | byte | byte | byte | byte | --- | byte | --- | --- | byte | --- | --- | byte | byte | --- | --- | --- | --- | --- |
short getShort() | short | short | short | short | short | --- | short | --- | --- | short | --- | --- | short | short | --- | --- | --- | --- | --- |
int getInt() | int | int | int | int | int | --- | int | --- | --- | int | --- | --- | int | int | --- | --- | --- | --- | --- |
long getLong() | long | long | long | long | long | long | long | --- | --- | long | --- | --- | long | long | --- | --- | --- | --- | --- |
java.math.BigInteger getBigInteger() | BigInteger | BigInteger | BigInteger | BigInteger | BigInteger | --- | BigInteger | BigInteger | --- | --- | --- | --- | BigInteger | --- | --- | --- | --- | --- | --- |
double getFloat() | float | float | float | float | float | --- | float | float | float | --- | --- | --- | float | --- | --- | --- | --- | --- | --- |
double getDouble() | double | double | double | double | double | --- | double | double | double | --- | --- | --- | double | --- | --- | --- | --- | --- | --- |
java.math.BigDecimal getBigDecimal() | BigDecimal | BigDecimal | BigDecimal | BigDecimal | BigDecimal | --- | BigDecimal | BigDecimal | BigDecimal | --- | --- | --- | BigDecimal | --- | BigDecimal | BigDecimal | --- | --- | --- |
java.util.Date getDate() | Date | --- | --- | --- | --- | Date | --- | --- | --- | --- | Date | Date | Date | --- | --- | --- | --- | --- | --- |
java.util.Date getTime() | Date | --- | --- | --- | --- | Date | --- | --- | --- | --- | --- | Date | Date | --- | --- | --- | --- | --- | --- |
byte[] getByteArray() | byte[] | --- | --- | --- | --- | --- | --- | --- | --- | byte[] | --- | --- | byte[] | byte[] | byte[] | byte[] | --- | --- | --- |
java.io.InputStream getBinaryStream() | InputStream | --- | --- | --- | --- | --- | --- | --- | --- | InputStream | --- | --- | InputStream | InputStream | --- | --- | --- | --- | --- |
java.io.Reader getCharacterStream() | Reader | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | Reader | --- | --- | --- | --- | --- | --- |
com.sap.conn.jco.JCoStructure getStructure() | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | JCoStructure | --- | --- |
com.sap.conn.jco.JCoTable getTable() | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | JCoTable | --- |
com.sap.conn.jco.JCoAbapObject getAbapObject() | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | JCoAbapObject |
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears the record and resets everything to its initial state.clone()
Clones the record instance.int
Copies the matching fields from the source record into this record.void
Deserializes all values from a given JSON representation into the fields of theJCoRecord
from a Reader.void
Deserializes all values from a given JSON representation into the fields of theJCoRecord
.getAbapObject
(int index) Returns the value of the specified field as aJCoAbapObject
.getAbapObject
(String fieldName) Returns the value of the specified field as aJCoAbapObject
.getBigDecimal
(int index) Returns the value of the i'th field as a BigDecimal object.getBigDecimal
(String fieldName) Returns the value of the i'th field as a BigDecimal object.getBigInteger
(int index) Returns the value of the i'th field as a BigInteger object.getBigInteger
(String fieldName) Returns the value of the i'th field as a BigInteger object.getBinaryStream
(int index) Returns the value of the i'th field as a stream of uninterpreted bytes in form of a java.io.InputStream object.getBinaryStream
(String fieldName) Returns the value of the named field as a stream of uninterpreted bytes in form of a java.io.InputStream object.byte
getByte
(int index) Returns the value of the i'th field as a byte.byte
Returns the value of the named field as a byte.byte[]
getByteArray
(int index) Returns the value of the i'th field as a byte array.byte[]
getByteArray
(String fieldName) Returns the value of the named field as a byte array.char
getChar
(int index) Returns the value of the i'th field as a char.char
Returns the value of the named field as a char.getCharacterStream
(int index) Returns the value of the i'th field as a stream of characters in form of a java.io.Reader object.getCharacterStream
(String fieldName) Returns the value of the named field as a stream of characters in form of a java.io.Reader object.char[]
getCharArray
(int index) Returns the value of the i'th field as a char array.char[]
getCharArray
(String fieldName) Returns the value of the named field as a char array.getClassNameOfValue
(String fieldName) Returns the fully qualified name of the Java class whose instances are manufactured if the methods getValue(int index) or getValue(String fieldName) are called to retrieve a value from the field.getDate
(int index) Returns the value of the i'th field as aDate
object containing a date or time value.Returns the value of the named field as aDate
object containing a date or time value.double
getDouble
(int index) Returns the value of the i'th field as a double.double
Returns the value of the named field as a double.getField
(int index) Returns the i'th field.Returns the named field.int
Returns the number of fields in this container.Returns a JCoFieldIterator.float
getFloat
(int index) Returns the value of the i'th field as a float.float
Returns the value of the named field as a float.int
getInt
(int index) Returns the value of the i'th field as an integer.int
Returns the value of the named field as an integer.long
getLong
(int index) Returns the value of the i'th field as a long.long
Returns the value of the named field as a long.Returns the appropriated metadata object that was used for creation of this record.short
getShort
(int index) Returns the value of the i'th field as a short.short
Returns the value of the named field as a short.getString
(int index) Returns the value of the i'th field as a String.Returns the value of the named field as a String object.getStructure
(int index) Returns the value of the i'th field as a JCoStructure object.getStructure
(String fieldName) Returns the value of the named field as a JCoStructure object.getTable
(int index) Returns the value of the i'th field a JCoTable object.Returns the value of the named field as a JCoTable object.getTime
(int index) Returns the value of the i'th field as aDate
object containing a time value.Returns the value of the named field as aDate
object containing a time value.getValue
(int index) Generic method that returns the value of the i'th field as an object.Returns the value of the named field as an object.boolean
isInitialized
(int index) Checks whether this field has been initialized.boolean
isInitialized
(String fieldName) Checks whether this field has been initialized.iterator()
Returns an Iterator.void
setValue
(int index, byte value) Sets the byte as the value for the i'th field.void
setValue
(int index, byte[] value) Sets the byte array as the value for the i'th field.void
setValue
(int index, char value) Sets the specified character as the field's value.void
setValue
(int index, char[] value) Sets the specified character array as the field's value.void
setValue
(int index, char[] value, int from, int length) Sets a sequence of characters from the specified character array as the field's value.void
setValue
(int index, double value) Sets the double as the value for the i'th field.void
setValue
(int index, float value) Sets the float as the value for the i'th field.void
setValue
(int index, int value) Sets the int as the value for the i'th field.void
setValue
(int index, long value) Sets the long as the value for the i'th field.void
setValue
(int index, short value) Sets the short as the value for the i'th field.void
setValue
(int index, JCoAbapObject abapObject) Sets the value of the specified field to be the givenJCoAbapObject
.void
setValue
(int index, JCoStructure value) Sets the structure as the value for the i'th field.void
Sets the table as the value for the i'th field.void
Sets the object as the value for the i'th field.void
Sets the specified string as the field's value.void
setValue
(int index, BigDecimal value) Sets the BigDecimal as the value for the i'th field.void
setValue
(int index, BigInteger value) Sets the BigInteger as the value for the i'th field.void
Sets the Date as the value for the i'th field.void
Sets the byte as the value for the named field.void
Sets the byte array as the value for the named field.void
Sets the character as the value for the named field.void
Sets the specified character array as the value for the named field.void
Sets a sequence of characters from the specified character array as the value for the named field.void
Sets the double as the value for the named field.void
Sets the float as the value for the named field.void
Sets the int as the value for the named field.void
Sets the long as the value for the named field.void
Sets the short as the value for the named field.void
setValue
(String fieldName, JCoAbapObject abapObject) Sets the value of the specified field to be the givenJCoAbapObject
.void
setValue
(String name, JCoStructure value) Sets the structure as the value for the named field.void
Sets the table as the value for the named field.void
Sets the object as the value for the named field.void
Sets the string as the value for the named field.void
setValue
(String name, BigDecimal value) Sets the BigDecimal as the value for the named field.void
setValue
(String name, BigInteger value) Sets the BigInteger as the value for the named field.void
Sets the Date as the value for the named field.toJSON()
Returns the whole record in a JSON representation.void
Serializes the whole record in a JSON representation to a Writer.toXML()
Returns the whole record in XML format.toXML
(int index) Returns the value of the i'th field as an XML string.Returns the value of the named field as an XML string.Writes the field specified by the index to the provided Writer.Writes the named field to the provided Writer.Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
getMetaData
JCoMetaData getMetaData()Returns the appropriated metadata object that was used for creation of this record.- Returns:
- JCoMetaData instance of the appropriated metadata object
-
clear
void clear()Clears the record and resets everything to its initial state. -
clone
Object clone()Clones the record instance.- Returns:
- a cloned instance of JCorecord
-
copyFrom
Copies the matching fields from the source record into this record. Data fields are considered to be equivalent if the name and type of two fields match. The data will be copied and converted as best as can, i.e. strings will be cut off if the source field is longer than the destination field, or they will be filled with spaces if the source is shorter than the destination, etc. If a single conversion fails, the whole copy operation will fail and the record will be left untouched. If the JCoRecord is a JCoTable, then the data from the source will be appended. This means that, if the source is a JCoStructure a single row will be appended to the end of the JCoTable, and if the source is a JCoTable all its rows will be appended to the end of the JCoTable.
If the JCoRecord is a JCoStructure or a JCoParameterList the data will be overwritten by the source. In case that the source is a JCoTable, the data is copied from the current row, i.e. the row the row pointer points to.- Parameters:
source
- the source record from which to copy the data- Returns:
- the number of matching fields (columns)
- Throws:
JCoRuntimeException
- if something went wrong
-
getFieldCount
int getFieldCount()Returns the number of fields in this container.- Returns:
- the number of fields
-
getField
Returns the i'th field.- Parameters:
index
- the index of the field- Returns:
- the field for the given index
- Since:
- JCo 3.1.0
-
getField
Returns the named field.- Parameters:
fieldName
- the name of the field- Returns:
- the field with the given name
- Since:
- JCo 3.1.0
-
getValue
Generic method that returns the value of the i'th field as an object.
Depending on the type of the field the method returns the following object:
Field datatype Object JCoMetaData.TYPE_CHAR java.lang.String JCoMetaData.TYPE_INT1 java.lang.Integer JCoMetaData.TYPE_INT2 java.lang.Integer JCoMetaData.TYPE_INT java.lang.Integer JCoMetaData.TYPE_INT8 java.lang.Long JCoMetaData.TYPE_NUM java.lang.String JCoMetaData.TYPE_BCD java.math.BigDecimal JCoMetaData.TYPE_FLOAT java.lang.Double JCoMetaData.TYPE_BYTE byte[] JCoMetaData.TYPE_UTCLONG java.lang.String JCoMetaData.TYPE_DATE java.util.Date JCoMetaData.TYPE_TIME java.util.Date JCoMetaData.TYPE_STRING java.lang.String JCoMetaData.TYPE_XSTRING byte[] JCoMetaData.TYPE_DECF16 java.math.BigDecimal JCoMetaData.TYPE_DECF34 java.math.BigDecimal JCoMetaData.TYPE_STRUCTURE com.sap.conn.jco.JCoStructure JCoMetaData.TYPE_TABLE com.sap.conn.jco.JCoTable JCoMetaData.TYPE_ABAPOBJECT com.sap.conn.jco.JCoAbapObject - Parameters:
index
- the field index- Returns:
- the value of the specified field
- Throws:
ConversionException
- thrown if the value could not be converted to an objectIndexOutOfBoundsException
- thrown if the index is out of range
-
getValue
Returns the value of the named field as an object.
Depending on the type of the field the method returns the following object:
Field datatype Object JCoMetaData.TYPE_CHAR java.lang.String JCoMetaData.TYPE_INT1 java.lang.Integer JCoMetaData.TYPE_INT2 java.lang.Integer JCoMetaData.TYPE_INT java.lang.Integer JCoMetaData.TYPE_INT8 java.lang.Long JCoMetaData.TYPE_NUM java.lang.String JCoMetaData.TYPE_BCD java.math.BigDecimal JCoMetaData.TYPE_FLOAT java.lang.Double JCoMetaData.TYPE_BYTE byte[] JCoMetaData.TYPE_UTCLONG java.lang.String JCoMetaData.TYPE_DATE java.util.Date JCoMetaData.TYPE_TIME java.util.Date JCoMetaData.TYPE_STRING java.lang.String JCoMetaData.TYPE_XSTRING byte[] JCoMetaData.TYPE_DECF16 java.math.BigDecimal JCoMetaData.TYPE_DECF34 java.math.BigDecimal JCoMetaData.TYPE_STRUCTURE com.sap.conn.jco.JCoStructure JCoMetaData.TYPE_TABLE com.sap.conn.jco.JCoTable JCoMetaData.TYPE_ABAPOBJECT com.sap.conn.jco.JCoAbapObject - Parameters:
fieldName
- the name of the field- Returns:
- the value of the specified field
- Throws:
ConversionException
- thrown if the value could not be converted to an objectJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
getString
Returns the value of the i'th field as a String.Note: If the data type of the field is TYPE_CHAR, this method trims all trailing blanks from the returned string. For the data types TYPE_DATE and TYPE_TIME the returned date and time strings are formatted using the patterns "yyyy-MM-dd" and "HH:mm:ss", respectively.
- Parameters:
index
- the index of the field- Returns:
- the field's value as a String object
- Throws:
ConversionException
- thrown if the value could not be converted to a StringIndexOutOfBoundsException
- thrown if the index is out of range
-
getString
Returns the value of the named field as a String object.Note: If the datatype of the field is TYPE_CHAR, this method trims all trailing blanks from the returned string. For the datatypes TYPE_DATE and TYPE_TIME the returned date and time strings are formatted using the patterns "yyyy-MM-dd" and "HH:mm:ss", respectively.
- Parameters:
fieldName
- the name of the field- Returns:
- the value of the specified field
- Throws:
ConversionException
- thrown if the value could not be converted to a StringJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
getChar
char getChar(int index) Returns the value of the i'th field as a char.- Parameters:
index
- the index of the field- Returns:
- the character of the field or ' ' if the field was empty.
- Throws:
ConversionException
- thrown if the value could not be converted to a char, i.e. if the underlying field contained more than one characterIndexOutOfBoundsException
- thrown if the index is out of range
-
getChar
Returns the value of the named field as a char.- Parameters:
fieldName
- the name of the field- Returns:
- the value of the specified field
- Throws:
ConversionException
- thrown if the value could not be converted to a charJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
getCharArray
char[] getCharArray(int index) Returns the value of the i'th field as a char array.Note: In contrast to
getString(int index)
this method does not trim trailing blanks and it does not format date and time fields with:
or-
separator chars.- Parameters:
index
- the field index- Returns:
- the value of the specified field
- Throws:
ConversionException
- thrown if the value could not be converted to a char arrayIndexOutOfBoundsException
- thrown if the index is out of range
-
getCharArray
Returns the value of the named field as a char array.Note: In contrast to
getString(String fieldName)
this method does not trim trailing blanks and it does not format date and time fields with:
or-
separator chars.- Parameters:
fieldName
- the name of the field- Returns:
- the field's value as a char array
- Throws:
ConversionException
- thrown if the value could not be converted to a char arrayJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
getByte
byte getByte(int index) Returns the value of the i'th field as a byte.- Parameters:
index
- the index of the field- Returns:
- the field's value as a byte
- Throws:
ConversionException
- thrown if the value could not be converted to a byteIndexOutOfBoundsException
- thrown if the index is out of range
-
getByte
Returns the value of the named field as a byte.- Parameters:
fieldName
- the name of the field- Returns:
- the value of the specified field
- Throws:
ConversionException
- thrown if the value could not be converted to a byteJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
getByteArray
byte[] getByteArray(int index) Returns the value of the i'th field as a byte array.- Parameters:
index
- the field index- Returns:
- the value of the specified field
- Throws:
ConversionException
- thrown if the value could not be converted to a byte arrayIndexOutOfBoundsException
- thrown if the index is out of range
-
getByteArray
Returns the value of the named field as a byte array.- Parameters:
fieldName
- the name of the field- Returns:
- the field's value as a byte array
- Throws:
ConversionException
- thrown if the value could not be converted to a byte arrayJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
getShort
short getShort(int index) Returns the value of the i'th field as a short.- Parameters:
index
- the index of the field- Returns:
- the field's value as a short
- Throws:
ConversionException
- thrown if the value could not be converted to a short
-
getShort
Returns the value of the named field as a short.- Parameters:
fieldName
- the name of the field- Returns:
- the value of the specified field
- Throws:
ConversionException
- thrown if the value could not be converted to a shortJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
getInt
int getInt(int index) Returns the value of the i'th field as an integer.- Parameters:
index
- the index of the field- Returns:
- the field's value as an integer
- Throws:
ConversionException
- thrown if the value could not be converted to an int
-
getInt
Returns the value of the named field as an integer.- Parameters:
fieldName
- the name of the field- Returns:
- the value of the specified field
- Throws:
ConversionException
- thrown if the value could not be converted to an intJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
getLong
long getLong(int index) Returns the value of the i'th field as a long.- Parameters:
index
- the index of the field- Returns:
- the field's value as a long
- Throws:
ConversionException
- thrown if the value could not be converted to an longIndexOutOfBoundsException
- thrown if the index is out of range
-
getLong
Returns the value of the named field as a long.- Parameters:
fieldName
- the name of the field- Returns:
- the value of the specified field
- Throws:
ConversionException
- thrown if the value could not be converted to a longJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
getFloat
float getFloat(int index) Returns the value of the i'th field as a float. Please use setValue(float value, ...) and getFloat(...) methods only if you operate with float values. Double value converted to float and back to double may also differ from original value. Please also don't mix those methods, because i.e. setting your values with setValue(float value, ...) and getting them using getDouble(...) may return not the same value.- Parameters:
index
- the index of the field- Returns:
- the field's value as a float
- Throws:
ConversionException
- thrown if the value could not be converted to a float
-
getFloat
Returns the value of the named field as a float. Please use setValue(float value, ...) and getFloat(...) methods only if you operate with float values. Double value converted to float and back to double may also differ from original value. Please also don't mix those methods, because i.e. setting your values with setValue(float value, ...) and getting them using getDouble(...) may return not the same value.- Parameters:
fieldName
- the name of the field- Returns:
- the value of the specified field
- Throws:
ConversionException
- thrown if the value could not be converted to a floatJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
getDouble
double getDouble(int index) Returns the value of the i'th field as a double.- Parameters:
index
- the index of the field- Returns:
- the field's value as a double
- Throws:
ConversionException
- thrown if the value could not be converted to a doubleIndexOutOfBoundsException
- thrown if the index is out of range
-
getDouble
Returns the value of the named field as a double.- Parameters:
fieldName
- the name of the field- Returns:
- the value of the specified field
- Throws:
ConversionException
- thrown if the value could not be converted to a doubleJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
getBigInteger
Returns the value of the i'th field as a BigInteger object.- Parameters:
index
- the index of the field- Returns:
- the field's value as a BigInteger object
- Throws:
ConversionException
- thrown if the value could not be converted to a BigIntegerIndexOutOfBoundsException
- thrown if the index is out of range
-
getBigInteger
Returns the value of the i'th field as a BigInteger object.- Parameters:
fieldName
- the name of the field- Returns:
- the field's value as a BigInteger object
- Throws:
ConversionException
- thrown if the value could not be converted to a BigIntegerJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
getBigDecimal
Returns the value of the i'th field as a BigDecimal object.- Parameters:
index
- the index of the field- Returns:
- the field's value as a BigDecimal object
- Throws:
ConversionException
- thrown if the value could not be converted to a BigDecimalIndexOutOfBoundsException
- thrown if the index is out of range
-
getBigDecimal
Returns the value of the i'th field as a BigDecimal object.- Parameters:
fieldName
- the name of the field- Returns:
- the field's value as a BigDecimal object
- Throws:
ConversionException
- thrown if the value could not be converted to a BigDecimalJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
getDate
Returns the value of the i'th field as aDate
object containing a date or time value. In case that the field is ofTYPE_UTCLONG
the returnedDate
object contains a full timestamp.
Note: A returnedDate
object containing a timestamp has a reduced precision with the split seconds from theTYPE_UTCLONG
field always being rounded down to milliseconds.- Parameters:
index
- the index of the field- Returns:
- the field's value as a
Date
object containing a date, time or timestamp value - Throws:
ConversionException
- thrown if the value could not be converted to a DateIndexOutOfBoundsException
- thrown if the index is out of range
-
getDate
Returns the value of the named field as aDate
object containing a date or time value. In case that the field is ofTYPE_UTCLONG
the returnedDate
object contains a full timestamp.
Note: A returnedDate
object containing a timestamp has a reduced precision with the split seconds from theTYPE_UTCLONG
field always being rounded down to milliseconds.- Parameters:
fieldName
- the name of the field- Returns:
- the specified field's value as a
Date
object containing a date, time or timestamp value - Throws:
ConversionException
- thrown if the value could not be converted to a DateJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
getTime
Returns the value of the i'th field as aDate
object containing a time value. In case that the field is ofTYPE_UTCLONG
the returnedDate
object contains a full timestamp.
Note: A returnedDate
object containing a timestamp has a reduced precision with the split seconds from theTYPE_UTCLONG
field always being rounded down to milliseconds.- Parameters:
index
- the index of the field- Returns:
- the field's value as a
Date
object containing a time or timestamp value - Throws:
ConversionException
- thrown if the value could not be converted to a DateIndexOutOfBoundsException
- thrown if the index is out of range
-
getTime
Returns the value of the named field as aDate
object containing a time value. In case that the field is ofTYPE_UTCLONG
the returnedDate
object contains a full timestamp.
Note: A returnedDate
object containing a timestamp has a reduced precision with the split seconds from theTYPE_UTCLONG
field always being rounded down to milliseconds.- Parameters:
fieldName
- the name of the field- Returns:
- the specified field's value as a
Date
object containing a time or timestamp value - Throws:
ConversionException
- thrown if the value could not be converted to a DateJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
getBinaryStream
Returns the value of the i'th field as a stream of uninterpreted bytes in form of a java.io.InputStream object.- Parameters:
index
- the index of the field- Returns:
- the field's value as a java.io.InputStream
- Throws:
ConversionException
- thrown if the value could not be converted to a java.io.InputStreamIndexOutOfBoundsException
- thrown if the index is out of range
-
getBinaryStream
Returns the value of the named field as a stream of uninterpreted bytes in form of a java.io.InputStream object.- Parameters:
fieldName
- the name of the field- Returns:
- the field's value as a java.io.InputStream
- Throws:
ConversionException
- thrown if the value could not be converted to a java.io.InputStreamJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
getCharacterStream
Returns the value of the i'th field as a stream of characters in form of a java.io.Reader object.- Parameters:
index
- the index of the field- Returns:
- the field's value as a java.io.Reader
- Throws:
ConversionException
- thrown if the value could not be converted to a java.io.ReaderIndexOutOfBoundsException
- thrown if the index is out of range
-
getCharacterStream
Returns the value of the named field as a stream of characters in form of a java.io.Reader object.- Parameters:
fieldName
- the name of the field- Returns:
- the field's value as a java.io.Reader
- Throws:
ConversionException
- thrown if the value could not be converted to a java.io.ReaderJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
getStructure
Returns the value of the i'th field as a JCoStructure object.- Parameters:
index
- the index of the field- Returns:
- the field's value as a JCoStructure
- Throws:
ConversionException
- thrown if the value could not be converted to a JCoStructureIndexOutOfBoundsException
- thrown if the index is out of range- See Also:
-
getStructure
Returns the value of the named field as a JCoStructure object.- Parameters:
fieldName
- the name of the field- Returns:
- the field's value as a JCoStructure
- Throws:
ConversionException
- thrown if the value could not be converted to a JCoStructureJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
getTable
Returns the value of the i'th field a JCoTable object.- Parameters:
index
- the index of the field- Returns:
- the field's value as a JCoTable
- Throws:
ConversionException
- thrown if the value could not be converted to a JCoTableIndexOutOfBoundsException
- thrown if the index is out of range- See Also:
-
getTable
Returns the value of the named field as a JCoTable object.- Parameters:
fieldName
- the name of the field- Returns:
- the field's value as a JCoTable
- Throws:
ConversionException
- thrown if the value could not be converted to a JCoTableJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
getAbapObject
Returns the value of the specified field as aJCoAbapObject
.- Parameters:
index
- the index of the field- Returns:
- the value of the field as a
JCoAbapObject
-
getAbapObject
Returns the value of the specified field as aJCoAbapObject
.- Parameters:
fieldName
- the name of the field- Returns:
- the value of the field as a
JCoAbapObject
-
getClassNameOfValue
Returns the fully qualified name of the Java class whose instances are manufactured if the methods getValue(int index) or getValue(String fieldName) are called to retrieve a value from the field.- Parameters:
fieldName
- the name of the field- Returns:
- the fully-qualified class name of the value object
- Throws:
JCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
setValue
Sets the specified string as the field's value. To set a value back to its initial type specific content pass "", i.e. an empty string, or null.- Parameters:
value
- the value to set for the fieldindex
- the index of the field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representation
-
setValue
Sets the string as the value for the named field. To set a value back to its initial type specific setting pass "", i.e. an empty string, or null- Parameters:
value
- the value to set for the fieldname
- the name of the field to set- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
setValue
void setValue(int index, char value) Sets the specified character as the field's value.- Parameters:
value
- the value to set for the fieldindex
- the index of the field- Throws:
IndexOutOfBoundsException
- thrown if the index is out of range
-
setValue
Sets the character as the value for the named field.- Parameters:
value
- the value to set for the fieldname
- the name of the field to set- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
setValue
void setValue(int index, char[] value) Sets the specified character array as the field's value.- Parameters:
value
- the value to set for the fieldindex
- the index of the field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationIndexOutOfBoundsException
- thrown if the index is out of range
-
setValue
Sets the specified character array as the value for the named field.- Parameters:
value
- the value to set for the fieldname
- the name of the field to set- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
setValue
void setValue(int index, char[] value, int from, int length) Sets a sequence of characters from the specified character array as the field's value.- Parameters:
value
- the array to copy the character sequence from for setting the fieldindex
- the index of the fieldfrom
- index of the first character in the char[] to copy fromlength
- the number of characters to copy- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationIndexOutOfBoundsException
- thrown if the index is out of range
-
setValue
Sets a sequence of characters from the specified character array as the value for the named field.- Parameters:
value
- the array to copy the character sequence from for setting the fieldname
- the name of the field to setfrom
- index of the first character in the char[] to copy fromlength
- the number of characters to copy- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
setValue
Sets the Date as the value for the i'th field.- Parameters:
value
- the value to set for the fieldindex
- the index of the field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationIndexOutOfBoundsException
- thrown if the index is out of range- Since:
- JCo 3.1.7
-
setValue
Sets the Date as the value for the named field.- Parameters:
value
- the value to set for the fieldname
- the name of the field to set- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist- Since:
- JCo 3.1.7
-
setValue
void setValue(int index, short value) Sets the short as the value for the i'th field.- Parameters:
value
- the value to set for the fieldindex
- the index of the field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationIndexOutOfBoundsException
- thrown if the index is out of range
-
setValue
Sets the short as the value for the named field.- Parameters:
value
- the value to set for the fieldname
- the name of the field to set- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
setValue
void setValue(int index, int value) Sets the int as the value for the i'th field.- Parameters:
value
- the value to set for the fieldindex
- the index of the field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationIndexOutOfBoundsException
- thrown if the index is out of range
-
setValue
Sets the int as the value for the named field.- Parameters:
value
- the value to set for the fieldname
- the name of the field to set- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
setValue
void setValue(int index, long value) Sets the long as the value for the i'th field.- Parameters:
value
- the value to set for the fieldindex
- the index of the field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationIndexOutOfBoundsException
- thrown if the index is out of range
-
setValue
Sets the long as the value for the named field.- Parameters:
value
- the value to set for the fieldname
- the name of the field to set- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
setValue
void setValue(int index, float value) Sets the float as the value for the i'th field. Please use setValue(float value, ...) and getFloat(...) methods only if you operate with float values. A double value converted to float and back to double may differ from the original value. Please also don't mix those methods, because e.g. setting your values with setValue(float value, ...) and getting them using getDouble(...) may not return the same value.- Parameters:
value
- the value to set for the fieldindex
- the index of the field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationIndexOutOfBoundsException
- thrown if the index is out of range
-
setValue
Sets the float as the value for the named field. Please use setValue(float value, ...) and getFloat(...) methods only if you operate with float values. A double value converted to float and back to double may also differ from the original value. Please also don't mix those methods, because e.g. setting your values with setValue(float value, ...) and getting them using getDouble(...) may not return the same value.- Parameters:
value
- the value to set for the fieldname
- the name of the field to set- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
setValue
void setValue(int index, double value) Sets the double as the value for the i'th field.- Parameters:
value
- the value to set for the fieldindex
- the index of the field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationIndexOutOfBoundsException
- thrown if the index is out of range
-
setValue
Sets the double as the value for the named field.- Parameters:
value
- the value to set for the fieldname
- the name of the field to set- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
setValue
void setValue(int index, byte value) Sets the byte as the value for the i'th field.- Parameters:
value
- the value to set for the fieldindex
- the index of the field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationIndexOutOfBoundsException
- thrown if the index is out of range
-
setValue
Sets the byte as the value for the named field.- Parameters:
value
- the value to set for the fieldname
- the name of the field to set- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
setValue
void setValue(int index, byte[] value) Sets the byte array as the value for the i'th field.- Parameters:
value
- the value to set for the fieldindex
- the index of the field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationIndexOutOfBoundsException
- thrown if the index is out of range
-
setValue
Sets the byte array as the value for the named field.- Parameters:
value
- the value to set for the fieldname
- the name of the field to set- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
setValue
Sets the BigDecimal as the value for the i'th field.- Parameters:
value
- the value to set for the fieldindex
- the index of the field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationIndexOutOfBoundsException
- thrown if the index is out of range
-
setValue
Sets the BigDecimal as the value for the named field.- Parameters:
value
- the value to set for the fieldname
- the name of the field to set- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
setValue
Sets the BigInteger as the value for the i'th field.- Parameters:
value
- the value to set for the fieldindex
- the index of the field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationIndexOutOfBoundsException
- thrown if the index is out of range- Since:
- JCo 3.1.7
-
setValue
Sets the BigInteger as the value for the named field.- Parameters:
value
- the value to set for the fieldname
- the name of the field to set- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist- Since:
- JCo 3.1.7
-
setValue
Sets the structure as the value for the i'th field.- Parameters:
value
- the value to set for the fieldindex
- the index of the field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationIndexOutOfBoundsException
- thrown if the index is out of range
-
setValue
Sets the structure as the value for the named field.- Parameters:
value
- the value to set for the fieldname
- the name of the field to set- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
setValue
Sets the table as the value for the i'th field.- Parameters:
value
- the value to set for the fieldindex
- the index of the field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationIndexOutOfBoundsException
- thrown if the index is out of range
-
setValue
Sets the table as the value for the named field.- Parameters:
value
- the value to set for the fieldname
- the name of the field to set- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
setValue
Sets the value of the specified field to be the givenJCoAbapObject
.- Parameters:
index
- the index of the fieldabapObject
- the value, aJCoAbapObject
-
setValue
Sets the value of the specified field to be the givenJCoAbapObject
.- Parameters:
fieldName
- the name of the fieldabapObject
- the value, aJCoAbapObject
-
setValue
Sets the object as the value for the i'th field.- Parameters:
value
- the value to set for the fieldindex
- the index of the field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationIndexOutOfBoundsException
- thrown if the index is out of range
-
setValue
Sets the object as the value for the named field.- Parameters:
value
- the value to set for the fieldname
- the name of the field to set- Throws:
ConversionException
- thrown if the value could not be converted to its internal representationJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
isInitialized
boolean isInitialized(int index) Checks whether this field has been initialized.- Parameters:
index
- of field that will be checked- Returns:
- true if the field has been initialized, false otherwise
- Throws:
IndexOutOfBoundsException
- thrown if the index is out of range
-
isInitialized
Checks whether this field has been initialized.- Parameters:
fieldName
- of field that will be checked- Returns:
- true if the field has been initialized, false otherwise
- Throws:
JCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
toXML
Returns the value of the i'th field as an XML string.
Its format is depending on the used interface implementation, and is not guaranteed to remain stable. This method is meant to be used as a more powerful toString() variant, which allows to view the record field within XML viewing tools, and thus making it easier to have a closer look at single parameter values. It is not supposed to be used in productive scenarios.- Parameters:
index
- the index of the field- Returns:
- the field of the record in XML format
- Throws:
ConversionException
- thrown if the value could not be converted to a StringIndexOutOfBoundsException
- thrown if the index is out of range
-
toXML
Returns the value of the named field as an XML string.
Its format is depending on the used interface implementation, and is not guaranteed to remain stable. This method is meant to be used as a more powerful toString() variant, which allows to view the record field within XML viewing tools, and thus making it easier to have a closer look at single parameter values. It is not supposed to be used in productive scenarios.- Parameters:
fieldName
- the name of the field- Returns:
- the field of the record in XML format
- Throws:
ConversionException
- thrown if the value could not be converted to a StringJCoRuntimeException
- thrown with group JCO_ERROR_FIELD_NOT_FOUND if a field with the specified name does not exist
-
toXML
String toXML()Returns the whole record in XML format.
Its format is depending on the used interface implementation, and is not guaranteed to remain stable. This method is meant to be used as a more powerful toString() variant, which allows to view the record within XML viewing tools, and thus making it easier to have a closer look at single parameter values. It is not supposed to be used in productive scenarios.- Returns:
- the record in XML format
- Throws:
ConversionException
- thrown if the value could not be converted to a String
-
toJSON
String toJSON()Returns the whole record in a JSON representation.The format is the one as produced by a Simple Transformation for the corresponding data type in ABAP.
- Returns:
- the record in as JSON representation
- Since:
- JCo 3.1.0
-
toJSON
Serializes the whole record in a JSON representation to a Writer.Note: JCo will not close the writer. The format is the one as produced by a Simple Transformation for the corresponding data type in ABAP.
- Parameters:
writer
- a writer instance to which the document is written- Throws:
IOException
- if the underlying writer throws an IOException- Since:
- JCo 3.1.0
-
fromJSON
Deserializes all values from a given JSON representation into the fields of theJCoRecord
from a Reader.Note: JCo will not close the reader.
- Parameters:
reader
- Reader to read the values from.- Since:
- JCo 3.1.0
-
fromJSON
Deserializes all values from a given JSON representation into the fields of theJCoRecord
.- Parameters:
data
- the input JSON as a String- Since:
- JCo 3.1.0
-
write
Writes the field specified by the index to the provided Writer.
The method writes out the internal char array representation avoiding temporary objects. The output depends on the field type:
Field data type Output to the Writer instance JCoMetaData.TYPE_CHAR char buffer without trailing spaces JCoMetaData.TYPE_DATE chars in format yyyyMMdd JCoMetaData.TYPE_TIME chars in format HHmmss JCoMetaData.TYPE_UTCLONG chars in format yyyy-MM-ddTHH:mm:ss.SSSSSS JCoMetaData.TYPE_NUM char buffer JCoMetaData.TYPE_STRING string chars buffer JCoMetaData.TYPE_XSTRING hexadecimal representation of the xstring byte buffer JCoMetaData.TYPE_BYTE hexadecimal representation of the byte buffer JCoMetaData.TYPE_BCD char based representation of the number JCoMetaData.TYPE_FLOAT char based representation of the number JCoMetaData.TYPE_INT1 char based representation of the number JCoMetaData.TYPE_INT2 char based representation of the number JCoMetaData.TYPE_INT char based representation of the number JCoMetaData.TYPE_INT8 char based representation of the number JCoMetaData.TYPE_DECF16 char based representation of the number JCoMetaData.TYPE_DECF34 char based representation of the number JCoMetaData.TYPE_STRUCTURE not possible, exception will be thrown JCoMetaData.TYPE_TABLE not possible, exception will be thrown JCoMetaData.TYPE_ABAPOBJECT not possible, exception will be thrown - Parameters:
index
- of the field that should be written to outwriter
- writer instance used to write- Returns:
- the instance passed as parameter writer
- Throws:
ConversionException
- if the field is complexJCoRuntimeException
- with the key JCoException.JCO_ERROR_FIELD_NOT_FOUND if the field with the name is not availableIOException
- if writer throws IOException- Since:
- JCo 3.0.7
-
write
Writes the named field to the provided Writer.
The method writes out the internal char array representation avoiding temporary objects. The output depends on the field type:
Field data type Output to the Writer instance JCoMetaData.TYPE_CHAR char buffer without trailing spaces JCoMetaData.TYPE_DATE chars in format yyyyMMdd JCoMetaData.TYPE_TIME chars in format HHmmss JCoMetaData.TYPE_UTCLONG chars in format yyyy-MM-ddTHH:mm:ss.SSSSSS JCoMetaData.TYPE_NUM char buffer JCoMetaData.TYPE_STRING string chars buffer JCoMetaData.TYPE_XSTRING hexadecimal representation of the xstring byte buffer JCoMetaData.TYPE_BYTE hexadecimal representation of the byte buffer JCoMetaData.TYPE_BCD char based representation of the number JCoMetaData.TYPE_FLOAT char based representation of the number JCoMetaData.TYPE_INT1 char based representation of the number JCoMetaData.TYPE_INT2 char based representation of the number JCoMetaData.TYPE_INT char based representation of the number JCoMetaData.TYPE_INT8 char based representation of the number JCoMetaData.TYPE_DECF16 char based representation of the number JCoMetaData.TYPE_DECF34 char based representation of the number JCoMetaData.TYPE_STRUCTURE not possible, exception will be thrown JCoMetaData.TYPE_TABLE not possible, exception will be thrown JCoMetaData.TYPE_ABAPOBJECT not possible, exception will be thrown - Parameters:
fieldName
- name of the fieldwriter
- write that is used to write operation- Returns:
- the instance passed as parameter writer
- Throws:
ConversionException
- if the field is complexJCoRuntimeException
- with the key JCoException.JCO_ERROR_FIELD_NOT_FOUND if the field with the name is not availableIOException
- if writer throws IOException- Since:
- JCo 3.0.7
- See Also:
-
iterator
Returns an Iterator.Note: Method
remove()
is not supported. -
getFieldIterator
JCoFieldIterator getFieldIterator()Returns a JCoFieldIterator.- Returns:
- an iterator over all fields of this container
-