com.ibm.mq.headers
Interface MQHeader
All Superinterfaces:
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
- public interface MQHeader
- extends MQData
- 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
Modifier and Type | Interface and Description |
---|---|
|
MQHeader.Field
Interface representing an individual header field.
|
Method Summary
Modifier and Type | Method and Description |
---|---|
|
fields()
Returns a list of the fields in this header.
|
|
getValue(java.lang.String name)
Returns the value of the named field.
|
|
setValue(java.lang.String name,java.lang.Object value)
Sets the value of the named field.
|
|
type()
Returns the type name of this header.
|
Methods inherited from interface com.ibm.mq.headers.MQData |
---|
read, read, size, write, write |
Method Detail
getValue
- java.lang.Object getValue(java.lang.String 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.
Parameters:
name
- the field name. setValue
- void setValue(java.lang.String name,
- java.lang.Object value)
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. type
- java.lang.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
- java.util.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: