Interface MQHeader
- All Superinterfaces:
MQData
- All Known Implementing Classes:
com.ibm.mq.headers.internal.Header, MQCFBF, MQCFBF, MQCFBS, MQCFBS, MQCFGR, MQCFGR, MQCFH, MQCFH, MQCFIF, MQCFIF, MQCFIL, MQCFIL, MQCFIL64, MQCFIL64, MQCFIN, MQCFIN, MQCFIN64, MQCFIN64, MQCFSF, MQCFSF, MQCFSL, MQCFSL, MQCFST, MQCFST, MQCIH, MQDH, MQDLH, MQEPH, MQIIH, MQMD, MQMD1, MQMDE, MQRFH, MQRFH2, MQRMH, MQSAPH, MQTM, MQTM2, MQTMC2, MQWIH, MQXQH, PCFFilterParameter, PCFFilterParameter, PCFHeader, PCFHeader, PCFMessage, PCFMessage, PCFParameter, PCFParameter
Interface representing an MQ header. A header object can be read from or written to a message and
contains named fields. The methods defined on this interface provide generic access to field
content, and are intended for use by applications such as tooling that perform dynamic
introspection of arbitrary headers. These methods provide facilities to
- discover the fields in a given header instance using the fields method
- get or set the value of a field using the getValue and setValue methods
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.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceInterface representing an individual header field. -
Method Summary
-
Method Details
-
getValue
- Parameters:
name- the field name.- Returns:
- the value of the named field. The value will be a String, String [], Integer, int [], byte [] or MQHeader according to the field type. Individual header implementation classes provide convenience methods for field access, so this method is only used for dynamic access by applications manipulating arbitrary headers.
-
setValue
Sets the value of the named field. The value will be a String, String [], Integer, int [], byte [] or MQHeader according to the field type. Individual header implementation classes provide convenience methods for field access, so this method is only used for dynamic access by applications manipulating arbitrary headers.- Parameters:
name- the field name.value- A value to set to the field
-
type
String type()- Returns:
- the type name of this header. The type name will be equivalent to the C typedef for the structure, if applicable -- for example, MQDLH, MQRFH2, MQXQH and so on.
-
fields
List<?> fields()- Returns:
- a list of the fields in this header. The contents of the list are instances of MQHeader.Field. This method is only used for dynamic introspection by applications manipulating arbitrary headers.
- See Also:
-