|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A Field represents a specific field with its meta info - FieldDescriptor. A Row has an array of Field objects that holds the every values set into it. The Field defines the accessor methods to every field value in a Row as well as some getter methods to the attributes of a Field.
Field object instance can be retrieved from its corresponding Row object, by passing the appropriate FieldDescriptor as the parameter. Field object is bound to an appropriate FieldDescriptor value inside.
Usage Examples:
Getting a Field instance from an existing Row:
//retrieving a field instance from a Row using the FieldDescriptor
Field delvDateField = existingRow.getField(delvDateFieldDescriptor);
//retrieving the Row's key field
Field keyField = existingRow.getKeyField();
Accessing the Field value:
TimeField
Getting the value of the TimeField.
java.sql.Time fieldValue = timeDateField.getSqlTime();
Setting a new field value to the Time field
timeDateField.setValue(java.sql.Time.valueOf("12:00:00"));
CharacterField
Getting the value of the CharacterField.
String fieldValue = characterField.getCharacters();
Setting a new field value to the Character field
fieldValue.setValue("new Value");
DecimalField
Getting the value of the DecimalField.
BigDecimal fieldValue = decimalField.getBigDecimal();
Setting a new field value to the Decimal field.
fieldValue.setValue(new BigDecimal("123456789"));
NumericField
Getting the value of the NumericField.
BigInteger fieldValue = NumericField.getBigInteger();
Setting a new field value to the Numeric Field.
fieldValue.setValue(new BigInteger("123456789"));
The value can also be retrieved by the getValue method which can be cast to
the appropriate object type.
java.sql.Date fieldValue = (java.sql.Date)fieldObject.getValue();
DateField
Getting the value of the DateField.
java.sql.Date fieldValue = delvDateField.getSqlDate();
Setting a new field value to the date field
delvDateField.setValue(java.sql.Date.valueOf("2003-11-22"));
Retrieving the other grouped Fields:
e.g. delvDate and delvTime fields are grouped together in the metadata
grouptype for date and time is T
Field[] groupMates = delvDateField.getGroupFields(FieldGroupType.T);
Field delvTimeField = groupMates[0];
Or using the specific type
DateField delvDateField = parentRow.getDateField(delvDateFieldDescriptor);
TimeField delvTimeField = delvDateField.getPairedTimeField();
Copyright: Copyright (c) 2002
Company: SAP AG
Method Summary | |
FieldDescriptor |
getFieldDescriptor()
Returns The FieldDescriptor of the Field object. |
Field[] |
getGroupFields(FieldGroupType fieldGroupType)
Returns an array of other Field objects that are in the same specified group type. |
Row |
getRow()
Returns the row attribute of the Field object to which this Field instance belongs. |
java.lang.Object |
getValue()
Gets the value attribute of the Field object |
void |
modifyValue(java.lang.Object fieldValue)
Modifies the field value. |
void |
setValue(java.lang.Object fieldValue)
Deprecated. use modifyValue(Object) instead for better performance. |
Method Detail |
public java.lang.Object getValue()
public void setValue(java.lang.Object fieldValue) throws ModificationNotAllowedException, PersistenceException
modifyValue(Object)
instead for better performance.
fieldValue
- The new value
ModificationNotAllowedException
- thrown if the operation is not complying with the rules set in the metadata definition.
PersistenceException
- thrown if any persistent layer exception occurred during the retrievalpublic Row getRow()
public Field[] getGroupFields(FieldGroupType fieldGroupType)
fieldGroupType
- the type of Field grouping
FieldGroupType
public FieldDescriptor getFieldDescriptor()
FieldDescriptor
public void modifyValue(java.lang.Object fieldValue) throws ModificationNotAllowedException
setValue(Object)
and this method is that this method does the modification
only transient on this object.
To persist the change you need to call SyncBo.modifyRow(Row)
with the Row of this Field as parameter.
fieldValue
- the new field value
ModificationNotAllowedException
- if the modification is not allowed
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |