Websphere MQ Everyplace

com.ibm.mqe
Class MQeFields

java.lang.Object
  |
  +--com.ibm.mqe.MQe
        |
        +--com.ibm.mqe.MQeFields
All Implemented Interfaces:
MQeExceptionCodes
Direct Known Subclasses:
MQeMsgObject

public class MQeFields
extends MQe

This class is used to create a basic MQeFields object. This object is used to hold various data items and provide mechanisms to dump and restore these field items to or from a byte array.

Field items are assigned a character name at the time they are added to the MQeFields object. This name must:

Note : These rules are not enforced but the results are unpredictable if they are not followed.

This class is a descendant of MQe


Field Summary
static char ArraySeparator
          Constant representing the Array Separator used in Dynamic Arrays.
static char TypeArrayElements
          The datatype of a Field representing data which is a dynamic array.
static char TypeAscii
          The datatype of a Field representing data of type 'Ascii'.
static char TypeBoolean
          The datatype of a Field representing data of type 'boolean'.
static char TypeByte
          The datatype of a Field representing data of type 'byte'.
static char TypeDouble
          The datatype of a Field representing data of type 'double'.
static char TypeFields
          The datatype of a Field representing data which is an embedded MQeFields Object.
static char TypeFloat
          The datatype of a Field representing data of type 'float'.
static char TypeInt
          The datatype of a Field representing data of type 'int'.
static char TypeLong
          The datatype of a Field representing data of type 'long'.
static char TypeShort
          The datatype of a Field representing data of type 'short'.
static char TypeUnicode
          The datatype of a Field representing data of type 'Unicode'.
static char TypeUnTyped
          The datatype of a Field representing data of unknown type.
 
Fields inherited from class com.ibm.mqe.MQe
Admin_Queue_Name, Admin_Reply_Queue_Name, copyright, DeadLetter_Queue_Name, Event_Activate, Event_Attribute, Event_Authenticate, Event_Close, Event_Logoff, Event_Logon, Event_MiniCert_Validate, Event_Queue, Event_QueueManager, Event_UserBase, JMS_Version, MQ_Headers, MQe_Log_Audit_Failure, MQe_Log_Audit_Success, MQe_Log_Error, MQe_Log_Information, MQe_Log_Success, MQe_Log_Warning, Msg_BackoutCount, Msg_CorrelID, Msg_ExpireTime, Msg_LockID, Msg_MsgID, Msg_OriginQMgr, Msg_Priority, Msg_ReplyToQ, Msg_ReplyToQMgr, Msg_Resend, Msg_Style, Msg_Style_Datagram, Msg_Style_Reply, Msg_Style_Request, Msg_Time, Msg_WrapMsg, sccsid, System_Default_Queue_Name, version
 
Fields inherited from interface com.ibm.mqe.MQeExceptionCodes
Except_Active, Except_AdapterException, Except_AdapterMissingRemoteAddress, Except_Admin_ActionNotSupported, Except_Admin_InvalidField, Except_Admin_NotAdminMsg, Except_AdminAction, Except_Authenticate, Except_BadRequest, Except_BridgeListener, Except_Chnl_Attributes, Except_Chnl_ID, Except_Chnl_Limit, Except_Chnl_Overrun, Except_Closed, Except_Con_AdapterRequired, Except_Con_AliasAlreadyExists, Except_Con_AlreadyExists, Except_Con_InvalidName, Except_Connect_Failure, Except_ConnectonType, Except_Cryptor, Except_Data, Except_Duplicate, Except_JmxProperties, Except_Listener, Except_MessageStore, Except_MiniCertReg_ActivateFailed, Except_MiniCertReg_BadPIN, Except_MiniCertReg_NotOpen, Except_NotActive, Except_NotAllowed, Except_NotFound, Except_NotSupported, Except_PrivateReg_ActivateFailed, Except_PrivateReg_BadPIN, Except_PrivateReg_NotOpen, Except_PublicReg_ActivateFailed, Except_PublicReg_InvalidAddress, Except_PublicReg_InvalidRequest, Except_Q_Full, Except_Q_InvalidName, Except_Q_InvalidPriority, Except_Q_MsgTooLarge, Except_Q_NoMatchingMsg, Except_Q_TargetRegistryRequired, Except_QMgr_Activated, Except_QMgr_AlreadyExists, Except_QMgr_InvalidQMgrName, Except_QMgr_InvalidQName, Except_QMgr_NotActive, Except_QMgr_NotBridgeEnabled, Except_QMgr_NotConfigured, Except_QMgr_QDoesNotExist, Except_QMgr_QExists, Except_QMgr_QNotEmpty, Except_QMgr_RegistryDataVersion, Except_QMgr_UnknownQMgr, Except_QMgr_WrongQType, Except_Reg_AddFailed, Except_Reg_AlreadyExists, Except_Reg_AlreadyOpen, Except_Reg_CRTKeyDecFailed, Except_Reg_CRTKeySignFailed, Except_Reg_DeleteFailed, Except_Reg_DeleteRegistryFailed, Except_Reg_DoesNotExist, Except_Reg_InvalidSession, Except_Reg_ListFailed, Except_Reg_NotDefined, Except_Reg_NotSecure, Except_Reg_NullName, Except_Reg_OpenFailed, Except_Reg_ReadFailed, Except_Reg_RenameFailed, Except_Reg_ResetPINFailed, Except_Reg_SearchFailed, Except_Reg_UpdateFailed, Except_RemoteException, Except_Rule, Except_S_BadIntegrity, Except_S_BadSubject, Except_S_CertificateExpired, Except_S_Cipher, Except_S_InvalidAttribute, Except_S_InvalidSignature, Except_S_MiniCertNotAvailable, Except_S_MissingSection, Except_S_NoPresetKeyAvailable, Except_S_RegistryNotAvailable, Except_Stopped, Except_Syntax, Except_TimeOut, Except_Transporter, Except_TriggerTransmission, Except_Trnsport_QMgr, Except_Trnsport_Request, Except_Type, Except_UdpipAdapterStateException, Except_UdpipAdapterTimeOut, Except_UdpipAdapterUnableToConfirmSuccess, Except_UnCoded, Except_Uncontactable_DontTransmit
 
Constructor Summary
MQeFields()
          Default constructor which creates an empty MQeFields object.
MQeFields(byte[] data)
          Constructor with a byte array.
 
Method Summary
 boolean contains(java.lang.String item)
          Verifies that the field exists within the object.
 void copy(MQeFields from, boolean replace)
          Copies all fields.
 void copy(MQeFields from, boolean replace, java.lang.String item)
          Copies an individual field.
 char dataType(java.lang.String item)
          Determines the data type of a field in the object.
 MQeFields deepCopy()
          Creates a deep copy of this MQeFields object.
 void delete(java.lang.String item)
          Removes a field from the object.
 byte[] dump()
          
This method dumps the contents of this MQeFields object to a byte array, so that is can be restored using the restore() method.
static java.lang.String dumpedType(byte[] data)
          Returns the object type of the dumped MQeFields object.
 java.lang.String dumpToString(java.lang.String template)
          Produces a human readable representation of the contents of the MQeFields object.
 boolean equals(java.lang.Object match)
          Deprecated. The equals() method will change in the next release to conform with the Java Language Specification. Please use either the includes() method or the isEqualTo() method instead.
 java.util.Enumeration fields()
          Returns an enumeration of all the fields in the object.
 int getArrayLength(java.lang.String item)
          Extracts the length value of a dynamic array of specified fields.
 byte[] getArrayOfByte(java.lang.String item)
          Extracts a fixed size array of bytes.
 long[] getArrayOfDoubleAsLong(java.lang.String item)
          Returns an array of long representing an array of double.
 int[] getArrayOfFloatAsInt(java.lang.String item)
          Returns an array of int representing an array of float.
 int[] getArrayOfInt(java.lang.String item)
          Returns an array of int.
 long[] getArrayOfLong(java.lang.String item)
          Returns an array of long.
 short[] getArrayOfShort(java.lang.String item)
          Returns an array of short.
 java.lang.String getAscii(java.lang.String item)
          Extracts an Ascii string from the MQeFields object.
 java.lang.String[] getAsciiArray(java.lang.String item)
          Extracts an Ascii array of strings from the MQeFields object.
 MQeAttribute getAttribute()
          Extracts the current attribute object reference associated with this MQeFields object.
 boolean getBoolean(java.lang.String item)
          Extracts a boolean value or null.
 byte getByte(java.lang.String item)
          Extracts a byte value.
 long getDoubleAsLong(java.lang.String item)
          Returns a long representing a double.
 MQeFields getFields(java.lang.String item)
          Extracts an embedded MQeFields object.
 MQeFields[] getFieldsArray(java.lang.String item)
          Extracts a dynamic size array of MQeFields objects.
 int getFloatAsInt(java.lang.String item)
          Returns an int representing a float.
 int getInt(java.lang.String item)
          Extracts an integer.
 int[] getIntArray(java.lang.String item)
          Deprecated. Use getArrayOfInt.
 long getLong(java.lang.String item)
          Extracts a long integer.
 long[] getLongArray(java.lang.String item)
          Deprecated. Use getArrayOfLong.
 java.lang.Object getObject(java.lang.String item)
          Deprecated.  
 short getShort(java.lang.String item)
          Extracts a short integer.
 short[] getShortArray(java.lang.String item)
          Deprecated. Use getArrayOfShort.
 java.lang.String getUnicode(java.lang.String item)
          Extracts a Unicode string.
 java.lang.String[] getUnicodeArray(java.lang.String item)
          Extracts a dynamic size array of Unicode strings.
 boolean includes(MQeFields match)
          Checks whether an object has a match with an MQeFields object field.
 boolean isEqualTo(java.lang.Object match)
          Checks for equality between MQeFields objects.
 void putArrayLength(java.lang.String item, int value)
          Sets the length value of a dynamic array of fields.
 void putArrayOfByte(java.lang.String item, byte[] itemData)
          Sets a fixed size array of bytes.
 void putArrayOfDoubleAsLong(java.lang.String item, long[] itemData)
          Adds an array of long representing an array of double.
 void putArrayOfFloatAsInt(java.lang.String item, int[] itemData)
          Adds an array of int representing an array of float.
 void putArrayOfInt(java.lang.String item, int[] itemData)
          Adds an array of int.
 void putArrayOfLong(java.lang.String item, long[] itemData)
          Adds an array of long.
 void putArrayOfShort(java.lang.String item, short[] itemData)
          Adds an array of short.
 void putAscii(java.lang.String item, java.lang.String itemData)
          Sets a string containing Ascii characters.
 void putAsciiArray(java.lang.String item, java.lang.String[] data)
          Sets a dynamic size array of strings containing Ascii characters.
 void putBoolean(java.lang.String item, boolean itemData)
          Sets a boolean value.
 void putByte(java.lang.String item, byte itemData)
          This method sets the data in the MQeFields object for the supplied byte.
 void putByteArray(java.lang.String item, byte[][] data)
          Adds an array of byte arrays.
 void putDoubleAsLong(java.lang.String item, long itemData)
          Adds a long representing a double field.
 void putFields(java.lang.String item, MQeFields theseFields)
          Sets an embedded MQeFields object.
 void putFieldsArray(java.lang.String item, MQeFields[] data)
          Sets an array of MQeFields objects.
 void putFloatAsInt(java.lang.String item, int itemData)
          Adds an int representing a float field.
 void putInt(java.lang.String item, int itemData)
          Sets an integer.
 void putIntArray(java.lang.String item, int[] data)
          Deprecated. Use putArrayOfInt.
 void putLong(java.lang.String item, long itemData)
          Sets a long integer.
 void putLongArray(java.lang.String item, long[] data)
          Deprecated. Use putArrayOfLong.
 void putObject(java.lang.String item, java.lang.Object itemData)
          Deprecated.  
 void putShort(java.lang.String item, short itemData)
          Sets a short integer.
 void putShortArray(java.lang.String item, short[] data)
          Deprecated. Use putArrayOfShort.
 void putUnicode(java.lang.String item, java.lang.String itemData)
          Sets a string containing Unicode characters.
 void putUnicodeArray(java.lang.String item, java.lang.String[] data)
          Sets a dynamic size array of strings containing Unicode characters.
 void rename(java.lang.String item, java.lang.String newName)
          Renames an item held within the MQeFields object.
 void restore(byte[] data)
          This method restores a MQeFields object from a byte array that was created using the dump method.
 void restoreFromString(java.lang.String template, java.lang.String data)
          Restores the contents of an MQeFields object from an Ascii string.
 void restoreFromString(java.lang.String endRecord, java.lang.String template, java.lang.String data)
          Restores the contents of an MQeFields object from an Ascii string.
static MQeFields restoreFromString(java.lang.String endRecord, java.lang.String sectionMatch, java.lang.String template, java.lang.String data)
          Restores the contents of an MQeFields object from an Ascii string.
 void setAttribute(MQeAttribute attribute)
          Assigns an attribute object to an MQeFields object.
 long updateValue(java.lang.String item, long update)
          Updates (increments or decrements) an integer type value within an MQeFields object.
 
Methods inherited from class com.ibm.mqe.MQe
abbreviate, alias, asciiToByte, byteToAscii, byteToHex, byteToHex, byteToInt, byteToLong, byteToShort, byteToUnicode, fileSeparator, getEventLogHandler, hexToAscii, hexToByte, intToByte, isCLDC, loadClass, loadObject, log, setEventLogHandler, setLoader, sliceByteArray, type, unicodeToByte, uniqueValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ArraySeparator

public static final char ArraySeparator
Constant representing the Array Separator used in Dynamic Arrays.

See Also:
Constant Field Values

TypeUnTyped

public static final char TypeUnTyped
The datatype of a Field representing data of unknown type.

See Also:
Constant Field Values

TypeAscii

public static final char TypeAscii
The datatype of a Field representing data of type 'Ascii'.

See Also:
Constant Field Values

TypeUnicode

public static final char TypeUnicode
The datatype of a Field representing data of type 'Unicode'.

See Also:
Constant Field Values

TypeBoolean

public static final char TypeBoolean
The datatype of a Field representing data of type 'boolean'.

See Also:
Constant Field Values

TypeByte

public static final char TypeByte
The datatype of a Field representing data of type 'byte'.

See Also:
Constant Field Values

TypeShort

public static final char TypeShort
The datatype of a Field representing data of type 'short'.

See Also:
Constant Field Values

TypeInt

public static final char TypeInt
The datatype of a Field representing data of type 'int'.

See Also:
Constant Field Values

TypeLong

public static final char TypeLong
The datatype of a Field representing data of type 'long'.

See Also:
Constant Field Values

TypeFloat

public static final char TypeFloat
The datatype of a Field representing data of type 'float'.

The float value has to be converted to an int prior to addition into an MQeFields Object

See Also:
Constant Field Values

TypeDouble

public static final char TypeDouble
The datatype of a Field representing data of type 'double'.

The double value has to be converted to a long prior to addition into an MQeFields Object.

See Also:
Constant Field Values

TypeArrayElements

public static final char TypeArrayElements
The datatype of a Field representing data which is a dynamic array.

Note : The specific datatype of the array can be retrieved by inquiring on one of the elements held within the dynamic array.

See Also:
Constant Field Values

TypeFields

public static final char TypeFields
The datatype of a Field representing data which is an embedded MQeFields Object.

See Also:
Constant Field Values
Constructor Detail

MQeFields

public MQeFields()

Default constructor which creates an empty MQeFields object.
The call to the ancestor constructor will increment the MQe object counter.

Example:
 MQeFields myFields = new com.ibm.mqe.MQeFields();
 
 

MQeFields

public MQeFields(byte[] data)
          throws java.lang.Exception

Constructor with a byte array. This restores an MQeFields object from the supplied byte array.
The call to the ancestor constructor will increment the MQe object counter.

Parameters:
data - A byte array containing a dumped MQeFields object.
Throws:
MQeException - Except_Type, Except_Data, Except_NotFound
java.lang.Exception - anything thrown by attribute.decodeData()
Method Detail

contains

public boolean contains(java.lang.String item)

Verifies that the field exists within the object.
This method verifies that a field exists within the MQeFields object.

Parameters:
item - The name of the item to be checked.
Returns:
True if the field was found. False, otherwise.
Example:
 boolean Contains = false;
 MQeFields msg = new MQeFields();
 
 try {
     msg.putAscii("Data", "This is some data");
 
     if (msg.contains("Data")) {
         Contains = true;
     }
 } catch (Exception e) {
     System.err.println("Failure ! " + e.toString());
 }
 return Contains;
 
 

copy

public void copy(MQeFields from,
                 boolean replace)
          throws java.lang.Exception

Copies all fields.
This method copies a reference to all fields from one MQeFields object to another.

Parameters:
from - The MQeFields object to be used as the source of the data, must not be null.
replace - A boolean controlling whether a field is to be replaced or not.
Returns:
void
Throws:
MQeException - Except_Duplicate
java.lang.Exception

copy

public void copy(MQeFields from,
                 boolean replace,
                 java.lang.String item)
          throws java.lang.Exception

Copies an individual field.
The boolean value replace , if set to false , throws an exception if the field already exists within the target MQeFields object, if set to true , it replaces the value that already exists.

Parameters:
from - The MQeFields object to be used as the source of the data, must not be null.
replace - A boolean controlling whether a field is to be replaced or not.
item - The name of a single field to be copied.
Returns:
void
Throws:
MQeException - Except_Duplicate, Except_NotFound
java.lang.Exception
Example:
 MQeFields fields1 = new MQeFields();
 MQeFields fields2 = new MQeFields();
 
 try {
     fields1.putAscii("data", "This is some data");
     fields2.copy(fields1, true, "data");
 } catch (Exception e) {
     System.err.println("Failure ! " + e.toString());
 }
 
 

dataType

public char dataType(java.lang.String item)
              throws java.lang.Exception

Determines the data type of a field in the object.
This method returns the data type of a field within the MQeFields object.

Parameters:
item - The name of the item to be checked.
Returns:
A character value representing the data type of the field. The predefined data types in MQeFields are:
      public final static char TypeUnTyped
      public final static char TypeAscii
      public final static char TypeUnicode
      public final static char TypeBoolean
      public final static char TypeByte
      public final static char TypeShort
      public final static char TypeInt
      public final static char TypeLong
      public final static char TypeFloat
      public final static char TypeDouble
      public final static char TypeArrayElements
      public final static char TypeFields
 
Throws:
MQeException - Except_NotFound
java.lang.Exception
Example:
 MQeFields msg = new MQeFields();
 char DataType = ' ';
 
 try {
     msg.putAscii("Data", "This is some data");
 
     if (msg.dataType("Data") == msg.TypeAscii) {
         DataType = msg.TypeAscii;// perform the necessary action here
     }
 } catch (Exception e) {
     System.err.println("Failure ! " + e.toString());
 }
 return DataType;
 
 

deepCopy

public MQeFields deepCopy()
                   throws java.lang.Exception
Creates a deep copy of this MQeFields object.

Returns:
MQeFields
Throws:
java.lang.ClassNotFoundException
MQeException - Except_Type, Except_Data, Except_NotFound
java.lang.Exception - anything thrown by attribute.decodeData()

delete

public void delete(java.lang.String item)

Removes a field from the object.
This method deletes an existing field from the MQeFields object.

Parameters:
item - The name of the item to be removed.
Returns:
void
Example:
 MQeFields msg = new MQeFields();
 
 try {
     msg.putAscii("Data", "This is some data");
 
     msg.delete("Data");
 } catch (Exception e) {
     System.err.println("Failure ! " + e.toString());
 }
 
 

dump

public byte[] dump()
            throws java.lang.Exception

This method dumps the contents of this MQeFields object to a byte array, so that is can be restored using the restore() method.

Returns:
byte[]
Throws:
MQeException - Except_Data, Except_NotAllowed, Except_Not_Found
java.lang.Exception
Example:
 byte dumpData[] = null;
 MQeFields msg = new MQeFields();
 
 try {
     msg.putAscii("Data", "This is some data");
 
     dumpData = msg.dump();
 } catch (Exception e) {
     System.err.println("Failure ! " + e.toString());
 }
 return dumpData;
 
 MQeFields fields = new MQeFields();
 String data = " ";
 
 try {
     fields.putBoolean("tb", true);
     fields.putLong("ml", -1);
     data = fields.dumpToString("Test1.obj (#0)\t#1 \t=#2 \r \n");
     System.out.println(fields.dumpToString("Test1.obj (#0)\t#1 \t=#2 \r \n"));
 } catch (Exception e) {
     System.err.println("Failure ! " + e.toString());
 }
 
 byte dumpdata[] = new byte[0];
 String ObjType = " ";
 MQeFields fields = new MQeFields();
 
 try {
     fields.putAscii("Data", "This is some data");
     dumpdata = fields.dump();
 
     ObjType = fields.dumpedType(dumpdata);
 } catch (Exception e) {
     System.err.println("Failure ! " + e.toString());
 }
 return ObjType;
 
 

dumpedType

public static java.lang.String dumpedType(byte[] data)
                                   throws java.lang.Exception

Returns the object type of the dumped MQeFields object.
This method returns a String containing the class name of the MQeFields object that was dumped.

Parameters:
data - A byte array containing a dump of an MQeFields object.
Returns:
A String containing the class name of the object that was dumped.
Throws:
java.lang.ClassNotFoundException
MQeException - Except_Type, Except_Data, Except_NotFound
java.lang.Exception - anything thrown by attribute.decodeData()
Example:
 byte dumpdata[] = new byte[0];
 String ObjType = " ";
 MQeFields fields = new MQeFields();
 
 try {
     fields.putAscii("Data", "This is some data");
     dumpdata = fields.dump();
 
     ObjType = fields.dumpedType(dumpdata);
 } catch (Exception e) {
     System.err.println("Failure ! " + e.toString());
 }
 return ObjType;
 
 

dumpToString

public java.lang.String dumpToString(java.lang.String template)
                              throws java.lang.Exception

Produces a human readable representation of the contents of the MQeFields object.
This method dumps the MQeFields object in human readable form and returns the data as a String.

Parameters:
template - A String template used when formatting the output.

The template should have 3 insert sequences ’#n’. That is :

  • #0 for the data type
  • #1 for the Field name
  • #2 for the field value

For example,
"(#0)#1=#2"
will return a string of the form:
"(ascii)item1=item1Data\r\n(int)Value=1234\r\n......"
Returns:
A String containing a representation of the MQeFields object.
Throws:
MQeException - Except_NotFound
java.lang.Exception
Example:
 MQeFields fields = new MQeFields();
 String data = " ";
 
 try {
     fields.putBoolean("tb", true);
     fields.putLong("ml", -1);
     data = fields.dumpToString("Test1.obj (#0)\t#1 \t=#2 \r \n");
     System.out.println(fields.dumpToString("Test1.obj (#0)\t#1 \t=#2 \r \n"));
 } catch (Exception e) {
     System.err.println("Failure ! " + e.toString());
 }
 
 

equals

public boolean equals(java.lang.Object match)
Deprecated. The equals() method will change in the next release to conform with the Java Language Specification. Please use either the includes() method or the isEqualTo() method instead.

Performs an equality test with another object.

Overrides:
equals in class java.lang.Object
Parameters:
match - An object to be compared with the MQeFields object.
Returns:
boolean If the parameter is an MQeFields object, true is returned if every field in the parameter has a matching field in the MQeFields, otherwise false is returned. Note that hidden fields are ignored when checking for a match.

If the parameter is not an MQeFields object, the value of super.equals(match) is returned.

Example:
 boolean Equals = false;
 MQeFields fields = new MQeFields();
 MQeFields test = new MQeFields();
 
 try {
     fields.putAscii("Data1", "This is some data");
     fields.putAscii("Data2", "This is more data");
 
     test.putAscii("Data1", "This is some data");
 
     if (fields.isEqualTo(test))    //should return true
         Equals = true;
     else
         Equals = false;
 } catch (Exception e) {
     System.err.println("Failure ! " + e.toString());
 }
 return Equals;
 
 

fields

public java.util.Enumeration fields()

Returns an enumeration of all the fields in the object.
This method returns an enumeration object that contains all the field names within the object.

Returns:
An enumeration object containing the field names.
Example:
 MQeFields fields = new MQeFields();
 Enumeration names = null;
 
 try {
     fields.putAscii("data", "This is some data");
 
     names = fields.fields();
 } catch (Exception e) {
     System.err.println("Failure ! " + e.toString());
 }
 return names;
 
 

getArrayLength

public int getArrayLength(java.lang.String item)
                   throws java.lang.Exception

Extracts the length value of a dynamic array of specified fields.
This extracts the dynamic array length of the specified item. An exception is thrown if there is no data or it is of the wrong data type.

Parameters:
item - The name of the item to be retrieved.
Returns:
An array of strings containing the Ascii data from the message.
Throws:
MQeException - Except_NotFound
java.lang.Exception
Example:
 MQeFields fields = new MQeFields(dumpdata);
 
 numElements = fields.getArrayLength("Data");
 return numElements;
 
 

getArrayOfByte

public byte[] getArrayOfByte(java.lang.String item)
                      throws java.lang.Exception

Extracts a fixed size array of bytes.
This extracts an array of bytes data from the MQeFields object. An exception is thrown if there is no data or it is of the wrong data type.

Parameters:
item - The name of the item to be retrieved.
Returns:
A byte array containing the data from the message.
Throws:
MQeException - Except_NotFound
java.lang.Exception
Example:
 MQeFields fields = new MQeFields();
 
 fields.restore(dumpdata);
 
 dumpdata = fields.getArrayOfByte("Data");
 return dumpdata;
 
 

getArrayOfDoubleAsLong

public long[] getArrayOfDoubleAsLong(java.lang.String item)
                              throws java.lang.Exception

Returns an array of long representing an array of double.

Parameters:
item - - a String containing the name of the item
Returns:
long[]
Throws:
MQeException - Except_NotFound
java.lang.Exception

getArrayOfFloatAsInt

public int[] getArrayOfFloatAsInt(java.lang.String item)
                           throws java.lang.Exception

Returns an array of int representing an array of float.

Parameters:
item - A String containing the name of the item
Returns:
int[]
Throws:
MQeException - Except_NotFound
java.lang.Exception

getArrayOfInt

public int[] getArrayOfInt(java.lang.String item)
                    throws java.lang.Exception
Returns an array of int.

Parameters:
item - A String containing the name of the item
Returns:
int[]
Throws:
MQeException - Except_NotFound
java.lang.Exception

getArrayOfLong

public long[] getArrayOfLong(java.lang.String item)
                      throws java.lang.Exception
Returns an array of long.

Parameters:
item - A String containing the name of the item
Returns:
long[]
Throws:
MQeException - Except_NotFound
java.lang.Exception

getArrayOfShort

public short[] getArrayOfShort(java.lang.String item)
                        throws java.lang.Exception
Returns an array of short.

Parameters:
item - A String containing the name of the item
Returns:
short[]
Throws:
MQeException - Except_NotFound
java.lang.Exception

getAscii

public java.lang.String getAscii(java.lang.String item)
                          throws java.lang.Exception

Extracts an Ascii string from the MQeFields object.
This extracts the Ascii data from the MQeFields object and returns it as a string. An exception is thrown if there is no data or it is of the wrong data type.
Note:The item parameter is a java Unicode string, which must only contain character codes that appear in the invariant part of the Ascii code pages (characters with values between 32 and 127 inclusive, not including {}[]#():;'"=). If you attempt to pass variant character codes, these codes are subject to translations between machines when different codepages are used to manipulate the data, possibly resulting in unpredictable results. If you wish to pass variant character codes in an WebSphere MQ Everyplace message, we recommend you use the putArrayOfByte() method and handle your own codepage translations between machines , or putUnicode() method where no codepage translations is required.

Parameters:
item - The name of the item to be retrieved.
Returns:
A string containing the Ascii data from the message.
Throws:
MQeException - Except_Type, Except_Not_Found
java.lang.Exception
Example:
 MQeFields fields = new MQeFields();
 
 fields.restore(dumpdata);
 data = fields.getAscii("Data");
 return data;
 
 MQeFields fields = new MQeFields();
 
 fields.restore(dumpdata);
 
 data = fields.getAsciiArray("Data");
 return data;
 
 

getAsciiArray

public java.lang.String[] getAsciiArray(java.lang.String item)
                                 throws java.lang.Exception

Extracts an Ascii array of strings from the MQeFields object.
This extracts the Ascii data (see note in getAscii() method description) from the MQeFields object and returns it as an array of strings. An exception is thrown if there is no data or it is of the wrong data type.

Parameters:
item - The name of the item to be retrieved.
Returns:
An array of strings containing the Ascii data from the message.
Throws:
MQeException - Except_NotFound
java.lang.Exception
Example:
 MQeFields fields = new MQeFields();
 
 fields.restore(dumpdata);
 
 data = fields.getAsciiArray("Data");
 return data;
 
 

getAttribute

public MQeAttribute getAttribute()

Extracts the current attribute object reference associated with this MQeFields object.
This method returns an MQeAttribute object reference associated with this MQeFields object, or null if there is no attribute.

Returns:
An MQeAttribute object reference.
Example:
 MQeAttribute thisAttribute = null;
 MQeFields fields = new MQeFields();
 
 thisAttribute = fields.getAttribute();
 return thisAttribute;
 
 

getBoolean

public boolean getBoolean(java.lang.String item)
                   throws java.lang.Exception

Extracts a boolean value or null.
This extracts a boolean value from the MQeFields object. An exception is thrown if there is no data or it is of the wrong data type.

Parameters:
item - The name of the item to be retrieved.
Returns:
A boolean set to either true or false.
Throws:
MQeException - Except_NotFound
java.lang.Exception
Example:
 MQeFields fields = new MQeFields();
 
 fields.restore(dumpdata);
 data = fields.getBoolean("Data");
 return data;
 
 

getByte

public byte getByte(java.lang.String item)
             throws java.lang.Exception

Extracts a byte value.
This extracts a byte of data from the MQeFields object. An exception is thrown if there is no data or it is of the wrong data type.

Parameters:
item - The name of the item to be retrieved.
Returns:
A byte containing the data from the field.
Throws:
MQeException - Except_NotFound
java.lang.Exception
Example:
 MQeFields fields = new MQeFields();
 
 fields.restore(dumpdata);
 data = fields.getByte("Data");
 return data;
 
 MQeFields fields =new MQeFields();
 fields.restore(dumpdata );
 
 byte data []=fields.getByteArray("Data");
 
 

getDoubleAsLong

public long getDoubleAsLong(java.lang.String item)
                     throws java.lang.Exception
Returns a long representing a double.

Parameters:
item - A String containing the name of the item
Returns:
long
Throws:
MQeException - Except_NotFound
java.lang.Exception
Example:
 MQeFields fields = new MQeFields();
 
 fields.restore(dumpdata);
 
 data = fields.getDoubleAsLong("Data");
 
 

getFields

public MQeFields getFields(java.lang.String item)
                    throws java.lang.Exception

Extracts an embedded MQeFields object.
This extracts a field item from the MQeFields object. An exception is thrown if there is no data or it is of the wrong data type.

Parameters:
item - The name of the item to be retrieved.
Returns:
MQeFields
Throws:
MQeException - Except_NotFound
java.lang.Exception
Example:
 MQeFields fields = new MQeFields();
 
 fields.restore(dumpdata);
 
 data = fields.getFields("Data");
 
 MQeFields fields = new MQeFields();
 
 fields.restore(dumpdata);
 
 data = fields.getFieldsArray("Data");
 
 

getFieldsArray

public MQeFields[] getFieldsArray(java.lang.String item)
                           throws java.lang.Exception

Extracts a dynamic size array of MQeFields objects.
This extracts a dynamic array of field objects from the MQeFields object and returns it as an array. The length of the array is determined by the ArrayLength value for this item. An exception is thrown if there is no data or it is of the wrong data type.

Parameters:
item - The name of the item to be retrieved.
Returns:
An array containing the MQeFields object.
Throws:
MQeException - Except_NotFound
java.lang.Exception
Example:
 MQeFields fields = new MQeFields();
 
 fields.restore(dumpdata);
 
 data = fields.getFieldsArray("Data");
 
 

getFloatAsInt

public int getFloatAsInt(java.lang.String item)
                  throws java.lang.Exception
Returns an int representing a float.

Parameters:
item - A String containing the name of the item
Returns:
int
Throws:
MQeException - Except_NotFound
java.lang.Exception
Example:
 MQeFields fields = new MQeFields();
 
 fields.restore(dumpdata);
 
 data = fields.getFloatAsInt("Data");
 
 

getInt

public int getInt(java.lang.String item)
           throws java.lang.Exception

Extracts an integer.
This extracts an int length integer value item from the MQeFields object. An exception is thrown if there is no data or it is of the wrong data type.

Parameters:
item - The name of the item to be retrieved.
Returns:
An int containing the value from the field.
Throws:
MQeException - Except_NotFound
java.lang.Exception
Example:
 MQeFields fields = new MQeFields();
 
 fields.restore(dumpdata);
 
 data = fields.getInt("Data");
 
 MQeFields fields =new MQeFields();
 fields.restore(dumpdata );
 
 int data []=fields.getIntArray("Data");
 
 

getIntArray

public int[] getIntArray(java.lang.String item)
                  throws java.lang.Exception
Deprecated. Use getArrayOfInt.

Returns an array of int.

Parameters:
item - A String containing the name of the item
Returns:
int[]
Throws:
MQeException - Except_NotFound
java.lang.Exception

getLong

public long getLong(java.lang.String item)
             throws java.lang.Exception

Extracts a long integer.
This extracts an long length integer value item from the MQeFields object. An exception is thrown if there is no data or it is of the wrong data type.

Parameters:
item - The name of the item to be retrieved.
Returns:
A long value from the field.
Throws:
MQeException - Except_NotFound
java.lang.Exception
Example:
 MQeFields fields = new MQeFields();
 
 fields.restore(dumpdata);
 
 data = fields.getLong("Data");
 
 MQeFields fields =new MQeFields();
 fields.restore(dumpdata );
 
 long data []=fields.getLongArray("Data");
 
 

getLongArray

public long[] getLongArray(java.lang.String item)
                    throws java.lang.Exception
Deprecated. Use getArrayOfLong.

Returns an array of long.

Parameters:
item - A String containing the name of the item
Returns:
long[]
Throws:
MQeException - Except_NotFound
java.lang.Exception

getObject

public java.lang.Object getObject(java.lang.String item)
                           throws java.lang.Exception
Deprecated.  

Returns a field object.
This method returns a field object from an array of MQeFields object.

Parameters:
item - The name of the item to be retrieved.
Returns:
Object
Throws:
MQeException - Except_NotFound
java.lang.Exception

getShort

public short getShort(java.lang.String item)
               throws java.lang.Exception

Extracts a short integer.
This extracts a short length integer value item from the MQeFields object. An exception is thrown if there is no data or it is of the wrong data type.

Parameters:
item - The name of the item to be retrieved
Returns:
A short integer containing the value from the field
Throws:
MQeException - Except_NotFound
java.lang.Exception
Example:
 MQeFields fields = new MQeFields();
 
 fields.restore(dumpdata);
 
 data = fields.getShort("Data");
 
 MQeFields fields =new MQeFields();
 fields.restore(dumpdata );
 
 short data []=fields.getShortArray("Data");
 
 

getShortArray

public short[] getShortArray(java.lang.String item)
                      throws java.lang.Exception
Deprecated. Use getArrayOfShort.

Purpose: return an array of shorts

Parameters:
item - - a String containing the name of the item
Returns:
short[]
Throws:
MQeException - Except_NotFound
java.lang.Exception

getUnicode

public java.lang.String getUnicode(java.lang.String item)
                            throws java.lang.Exception

Extracts a Unicode string.
This extracts the Unicode data from the MQeFields object and returns it as a string. An exception is thrown if there is no data or it is of the wrong data type.

Parameters:
item - The name of the item to be retrieved.
Returns:
A string containing the Unicode data from the message.
Throws:
MQeException - Except_NotFound
java.lang.Exception
Example:
 MQeFields fields = new MQeFields();
 
 fields.restore(dumpdata);
 
 data = fields.getUnicode("Data");
 
 MQeFields fields = new MQeFields();
 
 fields.restore(dumpdata);
 
 data = fields.getUnicodeArray("Data");
 
 

getUnicodeArray

public java.lang.String[] getUnicodeArray(java.lang.String item)
                                   throws java.lang.Exception

Extracts a dynamic size array of Unicode strings.
This extracts the Unicode data from the MQeFields object and returns it as an array of strings. An exception is thrown if there is no data or it is of the wrong data type.

Parameters:
item - The name of the item to be retrieved.
Returns:
An array of strings containing the Unicode data from the message
Throws:
MQeException - Except_NotFound
java.lang.Exception
Example:
 MQeFields fields = new MQeFields();
 
 fields.restore(dumpdata);
 
 data = fields.getUnicodeArray("Data");
 
 

putArrayLength

public void putArrayLength(java.lang.String item,
                           int value)
                    throws java.lang.Exception

Sets the length value of a dynamic array of fields.
This sets the dynamic array length of the specified item.

Parameters:
item - The name of the item to be set.
Returns:
void
Throws:
java.lang.Exception - Doesn't throw anything
Example:
 MQeFields fields = new MQeFields(dumpdata);
 
 fields.putArrayLength("Data", 5);
 
 

putArrayOfByte

public void putArrayOfByte(java.lang.String item,
                           byte[] itemData)
                    throws java.lang.Exception

Sets a fixed size array of bytes.
This method sets the data in the MQeFields object for the supplied byte array.

Parameters:
item - The name of the item to be set.
Returns:
void
Throws:
MQeException - Except_Not_Found
java.lang.Exception
Example:
 MQeFields fields = new MQeFields();
 
 fields.putArrayOfByte("Data", new byte[] {1, 2, 3, 4 }
 );
 
 

putArrayOfDoubleAsLong

public void putArrayOfDoubleAsLong(java.lang.String item,
                                   long[] itemData)
                            throws java.lang.Exception
Adds an array of long representing an array of double.

Parameters:
item - A String containing the name of the item
itemData - A long array to add to this Fields object
Throws:
MQeException - Except_Not_Found
java.lang.Exception

putArrayOfInt

public void putArrayOfInt(java.lang.String item,
                          int[] itemData)
                   throws java.lang.Exception
Adds an array of int.

Parameters:
item - A String containing the name of the item
itemData - An int array to add to this Fields object
Throws:
MQeException - Except_Not_Found
java.lang.Exception

putArrayOfLong

public void putArrayOfLong(java.lang.String item,
                           long[] itemData)
                    throws java.lang.Exception
Adds an array of long.

Parameters:
item - A String containing the name of the item
itemData - A long array to add to this Fields object
Throws:
MQeException - Except_Not_Found
java.lang.Exception

putArrayOfFloatAsInt

public void putArrayOfFloatAsInt(java.lang.String item,
                                 int[] itemData)
                          throws java.lang.Exception
Adds an array of int representing an array of float.

Parameters:
item - A String containing the name of the item
itemData - An int array to add to this Fields object
Throws:
MQeException - Except_Not_Found
java.lang.Exception

putArrayOfShort

public void putArrayOfShort(java.lang.String item,
                            short[] itemData)
                     throws java.lang.Exception
Adds an array of short.

Parameters:
item - A String containing the name of the item
itemData - A short array to add to this Fields object
Throws:
MQeException - Except_Not_Found
java.lang.Exception

putAscii

public void putAscii(java.lang.String item,
                     java.lang.String itemData)
              throws java.lang.Exception

Sets a string containing Ascii characters.
This method sets Ascii data (see note getAscii() method description) into the MQeFields object and sets the data type.

Parameters:
item - The name of the item to be set.
Returns:
void
Throws:
MQeException - Except_Not_Found
java.lang.Exception
Example:
 MQeFields fields = new MQeFields();
 
 fields.putAscii("Data", "This is some data");
 
 MQeFields fields = new MQeFields();
 
 data[0] = new String("This is some data");
 data[1] = new String("This is more data");
 fields.putAsciiArray("Data", data);
 
 

putAsciiArray

public void putAsciiArray(java.lang.String item,
                          java.lang.String[] data)
                   throws java.lang.Exception

Sets a dynamic size array of strings containing Ascii characters.
This method sets Ascii data (see note getAscii() method description) from an array of strings into the MQeFields object and sets the data type.

Parameters:
item - The name of the item to be set.
data - A string array containing the data to be set into the MQeFields object.
Returns:
void
Throws:
MQeException - Except_Not_Found
java.lang.Exception
Example:
 MQeFields fields = new MQeFields();
 
 data[0] = new String("This is some data");
 data[1] = new String("This is more data");
 fields.putAsciiArray("Data", data);
 
 

putBoolean

public void putBoolean(java.lang.String item,
                       boolean itemData)
                throws java.lang.Exception

Sets a boolean value.
This sets a boolean value into the MQeFields object.

Parameters:
item - The name of the item to be set.
Returns:
void
Throws:
MQeException - Except_Not_Found
java.lang.Exception
Example:
 MQeFields fields = new MQeFields();
 
 fields.restore(dumpdata);
 
 fields.putBoolean("Data", false);
 
 

putByte

public void putByte(java.lang.String item,
                    byte itemData)

This method sets the data in the MQeFields object for the supplied byte.

Parameters:
item - The name of the item to be set.
Returns:
void
Example:
 MQeFields fields = new MQeFields();
 
 data = 123;
 fields.putByte("Data", data);
 
 MQeFields fields =new MQeFields();
 
 byte data [][]=new byte [2][];
 data [1]= new byte[] {1,2,3,4};
 data [2]= new byte[] {5,6,7,8};
 fields.putByteArray("Data",data );
 
 

putByteArray

public void putByteArray(java.lang.String item,
                         byte[][] data)
                  throws java.lang.Exception
Adds an array of byte arrays.

Parameters:
item - A String containing the name of the item
data - An array of byte arrays to add to this Fields object
Throws:
MQeException - Except_Not_Found
java.lang.Exception

putDoubleAsLong

public void putDoubleAsLong(java.lang.String item,
                            long itemData)
Adds a long representing a double field.

Parameters:
item - A String containing the name of the item
itemData - A long value to add to this Fields object

putFields

public void putFields(java.lang.String item,
                      MQeFields theseFields)
               throws java.lang.Exception

Sets an embedded MQeFields object.
This method sets the data field as an item within this MQeFields object.

Parameters:
item - The name of the item to be set.
Returns:
void
Throws:
MQeException - Except_Not_Found, Except_NotAllowed
java.lang.Exception
Example:
 MQeFields fields = new MQeFields();
 
 MQeFields subFields = new MQeFields();
 
 fields.putFields("Data", subFields);
 
 MQeFields fields = new MQeFields();
 
 MQeFields[] subFields = new MQeFields[2];
 
 subFields[0] = new MQeFields();
 subFields[1] = new MQeFields();
 
 fields.putFieldsArray("Data", subFields);
 
 

putFieldsArray

public void putFieldsArray(java.lang.String item,
                           MQeFields[] data)
                    throws java.lang.Exception

Sets an array of MQeFields objects.
This method sets an array of fields into this MQeFields object.

Parameters:
item - The name of the item to be set.
data - An array of fields to be set into this MQeFields object.
Returns:
void
Throws:
MQeException - Except_Not_Found, Except_NotAllowed
java.lang.Exception
Example:
 MQeFields fields = new MQeFields();
 
 MQeFields[] subFields = new MQeFields[2];
 
 subFields[0] = new MQeFields();
 subFields[1] = new MQeFields();
 
 fields.putFieldsArray("Data", subFields);
 
 

putFloatAsInt

public void putFloatAsInt(java.lang.String item,
                          int itemData)
Adds an int representing a float field.

Parameters:
item - A String containing the name of the item
itemData - An int to add to this Fields object

putInt

public void putInt(java.lang.String item,
                   int itemData)

Sets an integer.
This method sets an integer into the MQeFields object.

Parameters:
item - The name of the item to be set.
Returns:
void
Example:
 MQeFields fields = new MQeFields();
 
 fields.putInt("Data", 123456);
 
 MQeFields fields =new MQeFields();
 
 int data []=new byte [2 ];
 data [1 ]=1234;data [2 ]=5678;
 fields.putIntArray("Data",data );
 
 

putIntArray

public void putIntArray(java.lang.String item,
                        int[] data)
                 throws java.lang.Exception
Deprecated. Use putArrayOfInt.

Adds an array of ints.

Parameters:
item - A String containing the name of the item
data - An intgegers array to add to this Fields object
Throws:
java.lang.Exception - Doesn't throw anything

putLong

public void putLong(java.lang.String item,
                    long itemData)

Sets a long integer.
This method sets a long value into the MQeFields object.

Parameters:
item - The name of the item to be set.
Returns:
void
Example:
 MQeFields fields = new MQeFields();
 
 fields.putLong("Data", 123456);
 
 MQeFields fields =new MQeFields();
 
 long data []= new byte [2];
 data [1]= 1234;
 data [2]= 5678;
 fields.putLongArray("Data",data );
 
 

putLongArray

public void putLongArray(java.lang.String item,
                         long[] data)
                  throws java.lang.Exception
Deprecated. Use putArrayOfLong.

Adds an array of longs.

Parameters:
item - A String containing the name of the item
data - A long array to add to this Fields object
Throws:
java.lang.Exception - Doesn't throw anything

putObject

public void putObject(java.lang.String item,
                      java.lang.Object itemData)
               throws java.lang.Exception
Deprecated.  

Sets an Object field with the data.
This method sets an object field with the data specified.

Parameters:
item - The name of the item to be set.
Throws:
MQeException - Except_Not_Found
java.lang.Exception

putShort

public void putShort(java.lang.String item,
                     short itemData)

Sets a short integer.
This method sets the a short value into the MQeFields object.

Parameters:
item - The name of the item to be set.
Returns:
void
Example:
 MQeFields fields = new MQeFields();
 
 data = 123;
 fields.putShort("Data", data);
 
 
 MQeFields fields =new MQeFields();
 
 short data []=new byte [2 ];
 data [1 ]=1234;
 data [2 ]=5678;
 fields.putShortArray("Data",data );
 
 

putShortArray

public void putShortArray(java.lang.String item,
                          short[] data)
                   throws java.lang.Exception
Deprecated. Use putArrayOfShort.

Adds an array of shorts.

Parameters:
item - A String containing the name of the item
data - A short array to add to this Fields object
Throws:
java.lang.Exception - Doesn't throw anything

putUnicode

public void putUnicode(java.lang.String item,
                       java.lang.String itemData)
                throws java.lang.Exception

Sets a string containing Unicode characters.
This method sets Unicode data into the MQeFields object and sets the data type.

Parameters:
item - The name of the item to be set
Returns:
void
Throws:
MQeException - Except_Not_Found
java.lang.Exception
Example:
 MQeFields msg = new MQeFields();
 
 msg.putUnicode("Data", "Merry xmas to all our readers");
 
 MQeFields msg = new MQeFields();
 
 data = new String[2];
 data[1] = "Merry xmas to all our readers";
 data[2] = "and a happy new year";
 System.out.println("Data1:" + data[1]);
 // msg.putUnicode("Data",data );
 
 

putUnicodeArray

public void putUnicodeArray(java.lang.String item,
                            java.lang.String[] data)
                     throws java.lang.Exception

Sets a dynamic size array of strings containing Unicode characters.
This method sets Unicode data into the MQeFields object for the string array and sets the data type.

Parameters:
item - The name of the item to be set.
data - An array of strings containing the data to be set into the MQeFields object.
Returns:
void
Throws:
MQeException - Except_Not_Found
java.lang.Exception
Example:
 MQeFields msg = new MQeFields();
 
 data = new String[2];
 data[1] = "Merry xmas to all our readers";
 data[2] = "and a happy new year";
 System.out.println("Data1:" + data[1]);
 // msg.putUnicode("Data",data );
 
 

rename

public void rename(java.lang.String item,
                   java.lang.String newName)
            throws java.lang.Exception

Renames an item held within the MQeFields object.
This method renames an existing item within the MQeFields object to the specified new name. If an item with the newName already exists in the MQeFields object, it is replaced by the renamed item.

Parameters:
newName - A String containing the new name of the item
Throws:
MQeException - Except_NotFound : Item + "not found"
java.lang.Exception
Example:
 MQeFields fields = new MQeFields();
 
 fields.rename("ThisItem", "ThatItem");
 
 

restore

public void restore(byte[] data)
             throws java.lang.Exception

This method restores a MQeFields object from a byte array that was created using the dump method.

Note: You can only restore an Object of the same type, use dumpedType(byte[]) to determine the type of the object within the byte array, then create a new Instance of this type in order to use the restore method.

Parameters:
data - A byte array containing a dumped MQeFields object.
Returns:
void
Throws:
MQeException - Except_Type, Except_Data, Except_NotFound
java.lang.Exception - anything thrown by attribute.decodeData()
Example:
 MQeFields fields = new MQeFields();
 
 fields.restore(dumpdata);
 
 MQeFields fields = MQeFields.restoreFromFile(File.separator +"directory"+
 File.separator +"thisfile.xyz",
 "\r \n",
 "[#0 ]",
 "#1=#2");
 
 MQeFields fields = new MQeFields();
 
 fields.putBoolean("tb", true);
 data = " ";
 fields.putLong("ml", -1);
 data = fields.dumpToString("Name=#1,Type=#0 Value=#2 \r \n");
 
 newFields = new MQeFields();
 newFields.restoreFromString("Name=#1,Type=#0 Value=#2 \r \n", data);
 
 

restoreFromString

public void restoreFromString(java.lang.String template,
                              java.lang.String data)
                       throws java.lang.Exception

Restores the contents of an MQeFields object from an Ascii string. (typically produced by dumpToString(java.lang.String) method call)
This method restores an individual item from a string.

Parameters:
template - A String template used to parse the input.

The template should have up to 3 insert sequences #n :

  • #0 for the data type
  • #1 for the Field name
  • #2 for the field value


For example, a template specified as:
"(#0)#1=#2\r\n"
will match items:
(ascii)item1=item1Data
(int)Value=1234

Note: Hidden state is not dumped/restored

data - The decorated string
Returns:
An MQeFields object containing the restored values.
Throws:
MQeException - Except_NotFound, Except_Syntax, Except_NotSupported
java.lang.Exception
Example:
 MQeFields fields = new MQeFields();
 
 fields.putBoolean("tb", true);
 data = " ";
 fields.putLong("ml", -1);
 data = fields.dumpToString("Name=#1,Type=#0 Value=#2 \r \n");
 
 newFields = new MQeFields();
 newFields.restoreFromString("Name=#1,Type=#0 Value=#2 \r \n", data);
 
 

restoreFromString

public void restoreFromString(java.lang.String endRecord,
                              java.lang.String template,
                              java.lang.String data)
                       throws java.lang.Exception

Restores the contents of an MQeFields object from an Ascii string.
A group of items from an EndRecord delimited string.

Note: A record that starts with an asterisk "*" is treated as a comment and blank records are ignored.

Parameters:
endRecord - A String containg the end of record identifier, each record MUST end with this string.
template - A pattern String used to parse the items. (refer to the previous method for example )
data - The decorated string.
Throws:
MQeException - Except_NotFound, Except_Syntax, Except_NotSupported
java.lang.Exception

restoreFromString

public static MQeFields restoreFromString(java.lang.String endRecord,
                                          java.lang.String sectionMatch,
                                          java.lang.String template,
                                          java.lang.String data)
                                   throws java.lang.Exception

Restores the contents of an MQeFields object from an Ascii string.
A nested MQeFields within MQeFields object from a SectionMatch and EndRecord delimited string.

Note: a record that starts with an asterisk "*" is treated as a comment and blank records are ignored.

Parameters:
endRecord - A String containg the end of record identifier, each record MUST end with this string.
sectionMatch - A pattern String identifying a section, a record MUST begin with section.
template - A pattern String used to parse the items.
data - The decorated string.
Returns:
MQeFields The restored MQeFields object.
Throws:
MQeException - Except_NotFound, Except_Syntax, Except_NotSupported, Except_NotAllowed
java.lang.Exception

setAttribute

public void setAttribute(MQeAttribute attribute)
                  throws java.lang.Exception

Assigns an attribute object to an MQeFields object.
This method assigns an attribute to be used to encode or decode the contents of the MQeFields object when ever it is dumped or restored.

Parameters:
attribute - An MQeAttribute object reference.
Returns:
void
Throws:
java.lang.Exception - Doesn't throw anything
Example:
 MQeFields fields = new MQeFields();
 
 MQeAttribute attr = new MQeAttribute(null, new MQeXorCryptor(), null);
 
 fields.setAttribute(attr);
 
 

updateValue

public long updateValue(java.lang.String item,
                        long update)
                 throws java.lang.Exception

Updates (increments or decrements) an integer type value within an MQeFields object.

Parameters:
item - The name of the item to be set.
update - A value to be added to the current value of the specified item.
Returns:
The updated value.
Throws:
MQeException - Except_Type, Except_Not_Found
java.lang.Exception
Example:
 long l = 0;
 MQeFields fields = new MQeFields();
 
 fields.putInt("Data", 123);
 l = fields.updateValue("Data", -3);
 return l;
 
 

includes

public boolean includes(MQeFields match)

Checks whether an object has a match with an MQeFields object field. must also exist in this object and have the same type and value (and not be hidden).
Each field in the parameter object is checked to see if there is a matching field in the MQeFields. In order to match, the field must have the same name, type and value (except for embedded MQeFields objects, see below). Hidden fields, in the parameter and in the MQeFields, are ignored when checking for a match.

If the parameter is null , the method returns true.

If a field in the parameter object is an embedded MQeFields object and an embedded MQeFields object with the same name exists in the main MQeFields, the two embedded fields objects are compared using includes().

Returns:
true if every field in the parameter has a matching field in the MQeFields object, otherwise false . Note that hidden fields are ignored when checking for a match.
Example:
 boolean Includes = false;
 MQeFields fields = new MQeFields();
 MQeFields test = new MQeFields();
 
 try {
     fields.putAscii("Data1", "This is some data");
     fields.putAscii("Data2", "This is more data");
 
     test.putAscii("Data1", "This is some data");
 
     if (fields.isEqualTo(test))    //should return true
         Includes = true;
     else
         Includes = false;
 } catch (Exception e) {
     System.err.println("Failure ! " + e.toString());
 }
 
 

isEqualTo

public boolean isEqualTo(java.lang.Object match)

Checks for equality between MQeFields objects.
If the parameter is an MQeFields (or descendent) object, the isEqualTo() method checks that the MQeFields object has exactly the same fields as the parameter. Each field in the MQeFields object should have a matching field in the parameter and each field in the parameter should have a matching field in the MQeFields object. In order to match, the field must have the same name, type and value. If the field is an embedded MQeFields object, isEqualTo() is used recursively to compare its value.

Hidden fields, in the parameter and in the MQeFields, are ignored when checking for a match.

If the parameter is not an MQeFields (or descendent) object, the value of super.equals(match)is returned.

If the parameter is null , the method returns false .

Parameters:
match - An object to be compared with the MQeFields object.
Returns:
If the parameter is an MQeFields object, true if the fields in the MQeFields object exactly match the fields in the parameter, otherwise false. Note that hidden fields are ignored when checking for a match. If the parameter is not an MQeFields object, the value of super.equals(match) is returned.
Example:
 MQeFields fields = new MQeFields();
 MQeFields test = new MQeFields();
 
 try {
     fields.putAscii("Data1", "This is some data");
     fields.putAscii("Data2", "This is more data");
 
     test.putAscii("Data1", "This is some data");
     test.putAscii("Data2", "This is more data");
 
     if (fields.isEqualTo(test))  //should return true
         IfEquals = true;
     else
         IfEquals = false;
 } catch (Exception e) {
     System.err.println("Failure ! " + e.toString());
 }
 
 

Websphere MQ Everyplace