TibrvMsg.removeField()
Method
Declaration
booleanremoveField
(
java.lang.String fieldName)
booleanremoveField
(
int fieldId)
booleanremoveField
(
java.lang.String fieldName,
int fieldId)
throws TibrvException
Purpose
Remove a field from a message.
Parameter |
Description |
|
Remove the field with this name. |
|
Remove the field with this identifier. |
Method Forms and the Field Search Algorithm
This method uses this algorithm to find and remove a field within a message, as specified by a field identifier and a field name.
Procedure
1. | If the program supplied zero as the identifier, or omitted any identifier, then begin at step 3. |
If the program supplied a non-zero field identifier, then search for the field with that identifier. If the search succeeds, remove the field and return true
.
On the search does not find a field, continue to step 2.
2. | If the identifier search (in step 1) fails, and the program supplied a non-null field name, then search for a field with that name. |
On the search does not find a field, or if the program supplied null
as the field name, return false
.
If the name search succeeds, but the actual identifier in the field is non-zero (so it does not match the identifier supplied) then throw an exception with the status code TibrvStatus.ID_CONFLICT.
If the search succeeds, remove the field and return true
.
3. | When the program supplied zero as the identifier, or omitted any identifier, then begin here. |
Search for a field with the specified name—even if that name is null
.
If the search succeeds, remove the field and return true
.
If the search does not find a field, return false
.
If a message contains several fields with the same name, searching by name removes the first instance of the field with that name.