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. parameter list, table, structure).


Method Summary
 java.math.BigDecimal getBigDecimal()
          Returns the field's value as a BigDecimal object
 java.math.BigInteger getBigInteger()
          Returns the field's value as a BigInteger object
 java.io.InputStream getBinaryStream()
          Returns the field's value as a stream of uninterpreted bytes, i.e.
 byte getByte()
          Returns the value of the i'th field as a byte
 byte[] getByteArray()
          Returns the field's value as a byte[] array
 int getByteLength()
          Returns the length of this field in non-Unicode layout
 char getChar()
          Returns the field's value as a character
 java.io.Reader getCharacterStream()
          Returns the value of the i'th field as a stream of characters, i.e.
 char[] getCharArray()
          Returns the field's value as a char array
 java.lang.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.
 java.util.Date getDate()
          Returns the field's value as a Date object
 int getDecimals()
          Returns the number of decimals of the field Decimals are only necessary for the data types JCoMetaData.TYPE_BCD and JCoMetaData.TYPE_FLOAT.
 java.lang.String getDescription()
          Returns a textual description for this field
 double getDouble()
          Returns the field's value as a double
 JCoExtendedFieldMetaData getExtendedFieldMetaData()
          Returns the extended field meta data object
 float getFloat()
          Returns the field's value as a float Please use setValue(float value, ...) and getFloat(...) methods only if you operate with float values.
 int getInt()
          Returns the field's value as an int
 int getLength()
          Returns the max length of the data field.
 long getLong()
          Returns the field's value as a long
 java.lang.String getName()
          Returns the name of this field
 JCoRecordMetaData getRecordMetaData()
          Returns the field meta data object in case of complex object (table or structure), or null
 short getShort()
          Returns the field's value as a short
 java.lang.String getString()
          Returns the field's value as a string
 JCoStructure getStructure()
          Returns the field's value as a JCoStructure object
 JCoTable getTable()
          Returns the field's value as a JCoTable object
 java.util.Date getTime()
          Returns the field's value as a Date object
 int getType()
          Returns the type of this field
 java.lang.String getTypeAsString()
          Returns the field's type as a string
 int getUnicodeByteLength()
          Returns the length of this field in Unicode layout
 java.lang.Object getValue()
          Returns the field's value as an object
 boolean isInitialized()
          Checks whether this field has been initialized
 boolean isStructure()
          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(JCoStructure value)
          Sets the specified structure as the field's value
 void setValue(JCoTable value)
          Sets the specified table as the field's value
 void setValue(long value)
          Sets the specified long as the field's value
 void setValue(java.lang.Object value)
          Sets the specified object as the field's value
 void setValue(short value)
          Sets the specified short as the field's value
 void setValue(java.lang.String value)
          Sets the specified string as the field's value.
 java.io.Writer write(java.io.Writer writer)
          Writes the field to writer.
 

Method Detail

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

java.lang.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. Note: in case of deep metadata the length for tables and structures can only be requested by their metadata directly.

Returns:
data field length

getDecimals

int getDecimals()
Returns the number of decimals of the field Decimals are only necessary for the data types JCoMetaData.TYPE_BCD and JCoMetaData.TYPE_FLOAT.

Returns:
number of decimals for the field.

getDescription

java.lang.String getDescription()
Returns a textual description for this field

Returns:
a text that describes the field or null if none available

getTypeAsString

java.lang.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 meta data object

Returns:
the extended field meta data object or null if not available

getRecordMetaData

JCoRecordMetaData getRecordMetaData()
Returns the field meta data object in case of complex object (table or structure), or null

Returns:
the field meta data object or null if not available

getClassNameOfValue

java.lang.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

java.lang.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

java.lang.String getString()
Returns the field's value as a string

Returns:
the field's value as a string
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

Returns:
the value of the specified field
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

java.math.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 value of the i'th field 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 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.

Returns:
the field's value as a float
Throws:
ConversionException - thrown if the value could not be converted to a float

getBigDecimal

java.math.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

java.util.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

java.util.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 array
Throws:
ConversionException - thrown if the value could not be converted to a byte[] array

getBinaryStream

java.io.InputStream getBinaryStream()
Returns the field's value as a stream of uninterpreted bytes, i.e. an 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

java.io.Reader getCharacterStream()
Returns the value of the i'th field as a stream of characters, i.e. an 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

void setValue(java.lang.Object value)
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

void setValue(java.lang.String value)
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 field
offset - in the value
length - 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

void setValue(JCoStructure value)
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

void setValue(JCoTable value)
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

java.io.Writer write(java.io.Writer writer)
                     throws java.io.IOException
Writes the field to 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.
java.io.IOException - if writer throws IOException
Since:
JCo 3.0.7
See Also:
JCoRecord.write(int, Writer)


Copyright © 2008-2014 SAP AG. All Rights Reserved.