Package com.sap.conn.jco
Interface JCoField
- All Known Subinterfaces:
JCoParameterField
,JCoRecordField
public interface JCoField
Class to represent a data field in a record (i.e. a parameter list, a table, a structure).
-
Method Summary
Modifier and TypeMethodDescriptionReturns the field's value as a BigDecimal object.Returns the field's value as a BigInteger object.Returns the field's value as a stream of uninterpreted bytes in form of a java.io.InputStream object.byte
getByte()
Returns the field's value as a as a byte.byte[]
Returns the field's value as a byte array.int
Returns the length of this field in non-Unicode layout.char
getChar()
Returns the field's value as a character.Returns the value of the i'th field as a stream of characters in form of a java.io.Reader object.char[]
Returns the field's value as a char array.Returns the fully-qualified name of the Java class whose instances are manufactured if the method Field.getValue() is called to retrieve a value from a field.getDate()
Returns the field's value as a Date object.int
Returns the number of decimals for this field.Returns a textual description for this field.double
Returns the field's value as a double.Returns the extended field metadata object.float
getFloat()
Returns the field's value as a float.int
getInt()
Returns the field's value as an int.int
Returns the max length of the data field.long
getLong()
Returns the field's value as a long.getName()
Returns the name of this field.Returns the field metadata object in case of complex object (table or structure), or null .short
getShort()
Returns the field's value as a short.Returns the field's value as a string.Returns the field's value as a JCoStructure object.getTable()
Returns the field's value as a JCoTable object.getTime()
Returns the field's value as a Date object.int
getType()
Returns the type of this field.Returns the field's type as a string.int
Returns the length of this field in Unicode layout.getValue()
Returns the field's value as an object.boolean
Checks whether this field has been initialized.boolean
Checks whether this field is a structure parameter.boolean
isTable()
Checks whether this field is a table parameter.void
setValue
(byte value) Sets the specified byte as the field's value.void
setValue
(byte[] value) Sets the specified byte array as the field's value.void
setValue
(char value) Sets the specified character as the field's value.void
setValue
(char[] value, int offset, int length) Sets the specified character array as the field's value.void
setValue
(double value) Sets the specified double as the field's value.void
setValue
(int value) Sets the specified integer as the field's value.void
setValue
(long value) Sets the specified long as the field's value.void
setValue
(short value) Sets the specified short as the field's value.void
setValue
(JCoStructure value) Sets the specified structure as the field's value.void
Sets the specified table as the field's value.void
Sets the specified object as the field's value.void
Sets the specified string as the field's value.Writes the field to a java.io.Writer.
-
Method Details
-
isInitialized
boolean isInitialized()Checks whether this field has been initialized.- Returns:
- true if the field has been initialized, false otherwise
-
isStructure
boolean isStructure()Checks whether this field is a structure parameter.- Returns:
- true if the field is a structure parameter, false otherwise
-
isTable
boolean isTable()Checks whether this field is a table parameter.- Returns:
- true if the field is a table parameter, false otherwise
-
getName
String getName()Returns the name of this field.- Returns:
- the name of this field
-
getType
int getType()Returns the type of this field.- Returns:
- the field type
-
getByteLength
int getByteLength()Returns the length of this field in non-Unicode layout.- Returns:
- the length of the field
-
getUnicodeByteLength
int getUnicodeByteLength()Returns the length of this field in Unicode layout.- Returns:
- the length of the field
-
getLength
int getLength()Returns the max length of the data field.- For the character based types the char length will be returned.
- For type STRING or XSTRING 0 will be returned.
- For type STRUCTURE or TABLE 0 will be returned.
- For numerical types the byte length will be returned.
- Returns:
- data field length
-
getDecimals
int getDecimals()Returns the number of decimals for this field. Decimals are only necessary for the data types JCoMetaData.TYPE_BCD and JCoMetaData.TYPE_FLOAT.- Returns:
- number of decimals for this field.
-
getDescription
String getDescription()Returns a textual description for this field.- Returns:
- a text that describes the field or null if none available
-
getTypeAsString
String getTypeAsString()Returns the field's type as a string.- Returns:
- the field's type as a string
-
getExtendedFieldMetaData
JCoExtendedFieldMetaData getExtendedFieldMetaData()Returns the extended field metadata object.- Returns:
- the extended field metadata object or null if not available
-
getRecordMetaData
JCoRecordMetaData getRecordMetaData()Returns the field metadata object in case of complex object (table or structure), or null .- Returns:
- the field metadata object or null if not available
-
getClassNameOfValue
String getClassNameOfValue()Returns the fully-qualified name of the Java class whose instances are manufactured if the method Field.getValue() is called to retrieve a value from a field.- Returns:
- the fully-qualified class name of the value object
-
getValue
Object getValue()Returns the field's value as an object.- Returns:
- the field's value as an object
- Throws:
ConversionException
- thrown if the value could not be converted to an Object
-
getString
String getString()Returns the field's value as a string.- Returns:
- the field's value as a String object
- Throws:
ConversionException
- thrown if the value could not be converted to a String
-
getChar
char getChar()Returns the field's value as a character.- Returns:
- the field's value as a char
- Throws:
ConversionException
- thrown if the value could not be converted to a char
-
getCharArray
char[] getCharArray()Returns the field's value as a char array.
Note: In contrast togetString()
this method does not trim trailing blanks and it does not format date and time fields with:
or-
separator chars.- Returns:
- the field's value as a char[]
- Throws:
ConversionException
- thrown if the value could not be converted to a char array
-
getShort
short getShort()Returns the field's value as a short.- Returns:
- the field's value as a short
- Throws:
ConversionException
- thrown if the value could not be converted to a short
-
getInt
int getInt()Returns the field's value as an int.- Returns:
- the field's value as an int
- Throws:
ConversionException
- thrown if the value could not be converted to a int
-
getLong
long getLong()Returns the field's value as a long.- Returns:
- the field's value as a long
- Throws:
ConversionException
- thrown if the value could not be converted to a long
-
getBigInteger
BigInteger getBigInteger()Returns the field's value as a BigInteger object.- Returns:
- the field's value as a BigInteger object
- Throws:
ConversionException
- thrown if the value could not be converted to a BigInteger
-
getDouble
double getDouble()Returns the field's value as a double.- Returns:
- the field's value as a double
- Throws:
ConversionException
- thrown if the value could not be converted to a double
-
getByte
byte getByte()Returns the field's value as a as a byte.- Returns:
- the field's value as a byte
- Throws:
ConversionException
- thrown if the value could not be converted to a byte
-
getFloat
float getFloat()Returns the field's value as a float. Use setValue(float value, ...) and getFloat(...) methods only if you operate with float values. A double value converted to a float and back to a double may also differ from the original value. Also don't mix those methods, because setting values with setValue(float value, ...) and getting them using getDouble(...) may not return the same value.- Returns:
- the field's value as a float
- Throws:
ConversionException
- thrown if the value could not be converted to a float
-
getBigDecimal
BigDecimal getBigDecimal()Returns the field's value as a BigDecimal object.- Returns:
- the field's value as a BigDecimal object
- Throws:
ConversionException
- thrown if the value could not be converted to a BigDecimal
-
getDate
Date getDate()Returns the field's value as a Date object.- Returns:
- the field's value as a Date object
- Throws:
ConversionException
- thrown if the value could not be converted to a Date
-
getTime
Date getTime()Returns the field's value as a Date object.- Returns:
- the field's value as a Date object
- Throws:
ConversionException
- thrown if the value could not be converted to a Date
-
getByteArray
byte[] getByteArray()Returns the field's value as a byte array.- Returns:
- the field's value as a byte[]
- Throws:
ConversionException
- thrown if the value could not be converted to a byte[] array.
-
getBinaryStream
InputStream getBinaryStream()Returns the field's value as a stream of uninterpreted bytes in form of a java.io.InputStream object.- Returns:
- the field's value as an java.io.InputStream
- Throws:
ConversionException
- thrown if the value could not be converted to an java.io.InputStream
-
getCharacterStream
Reader getCharacterStream()Returns the value of the i'th field as a stream of characters in form of a java.io.Reader object.- Returns:
- the field's value as an java.io.Reader
- Throws:
ConversionException
- thrown if the value could not be converted to an java.io.Reader
-
getTable
JCoTable getTable()Returns the field's value as a JCoTable object.- Returns:
- the field's value as a table
- Throws:
ConversionException
- thrown if the value could not be converted to a JCoTable
-
getStructure
JCoStructure getStructure()Returns the field's value as a JCoStructure object.- Returns:
- the field's value as a structure
- Throws:
ConversionException
- thrown if the value could not be converted to a JCoStructure
-
setValue
Sets the specified object as the field's value.- Parameters:
value
- the new value of this field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representation
-
setValue
Sets the specified string as the field's value. To set a value back to its initial type specific setting pass "", i.e. an empty string, or null- Parameters:
value
- the new value of this field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representation
-
setValue
void setValue(char value) Sets the specified character as the field's value.- Parameters:
value
- the new value of this field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representation
-
setValue
void setValue(char[] value, int offset, int length) Sets the specified character array as the field's value.- Parameters:
value
- the new value of this fieldoffset
- in the valuelength
- number of chars- Throws:
ConversionException
- thrown if the value could not be converted to its internal representation
-
setValue
void setValue(short value) Sets the specified short as the field's value.- Parameters:
value
- the new value of this field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representation
-
setValue
void setValue(int value) Sets the specified integer as the field's value.- Parameters:
value
- the new value of this field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representation
-
setValue
void setValue(long value) Sets the specified long as the field's value.- Parameters:
value
- the new value of this field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representation
-
setValue
void setValue(double value) Sets the specified double as the field's value.- Parameters:
value
- the new value of this field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representation
-
setValue
void setValue(byte[] value) Sets the specified byte array as the field's value.- Parameters:
value
- the new value of this field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representation
-
setValue
void setValue(byte value) Sets the specified byte as the field's value.- Parameters:
value
- the new value of this field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representation
-
setValue
Sets the specified structure as the field's value.- Parameters:
value
- the new value of this field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representation
-
setValue
Sets the specified table as the field's value.- Parameters:
value
- the new value of this field- Throws:
ConversionException
- thrown if the value could not be converted to its internal representation
-
write
Writes the field to a java.io.Writer.See JCoRecord.write(int, Writer) for details.
- Parameters:
writer
- writer instance used to write- Returns:
- the instance passed as parameter writer
- Throws:
ConversionException
- if the field is complex.IOException
- if writer throws IOException- Since:
- JCo 3.0.7
- See Also:
-