public interface MQHeader extends MQData
MQDLH dlh = ...
int reasonCode;
reasonCode = ((Integer) dlh.getValue ("ReasonCode")).intValue (); // Generic field access.
reasonCode = dlh.getReasonCode (); // Type-specific field access.
The type-specific field access method is much more efficient than the generic field access
method. The same applies to set operations.
If the application is one that is introspecting or composing messages dynamically, such as a message browser, then the generic approach is more flexible, and avoids having to detect the header type and then cast to a specific class. This suits tasks such as displaying all the headers in a message, or building new messages under user control.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
MQHeader.Field
Interface representing an individual header field.
|
java.lang.Object getValue(java.lang.String name)
name - the field name.void setValue(java.lang.String name,
java.lang.Object value)
name - the field name.value - java.lang.String type()
java.util.List<?> fields()
MQHeader.Field