com.codestreet.messageforge
Class RMsg

java.lang.Object
  extended bycom.codestreet.messageforge.RMsg
All Implemented Interfaces:
RMapMessage, java.io.Serializable

public class RMsg
extends java.lang.Object
implements RMapMessage

Base class for all message classes. A message contains a collection of RFld instances. Each message implements a fast-fail strategy for field validations - i.e. a field is validated each time its value is set. To make sure that a message is valid it is still important to call validate()to make sure that all non-optional fields have been set.

In the typical usage, a message object is defined via XML and the JAVA class for the message generated by the code-generator. In some other applications, it might be necessary to have the ability to create empty messages - messages with no fields - and add fields to these messages on the fly. Fields can be created explicitly or by using the RFldFactory.

Author:
Jawaid Hakim.
See Also:
Serialized Form

Field Summary
protected  java.lang.String desc_
          Message description.
protected  boolean emptyMsg_
          Field to indicate if this message has no fields.
protected static char EXPOSED_FIELD_DELIMITER
          Delimiter for exposed fields within string representation.
protected static char FIELD_EQUAL
          End delimiter for nested fields within string representation.
protected  java.lang.String fixedSendSubject_
          Fixed send subject.
protected  java.util.Map flds_
          Message fields.
protected  RFld[] fldsArray_
           
protected static char HASHTABLE_ENTRY_DELIMITER
          Delimiter for fields within hashtable entry string representation.
protected static char INDIRECT_COMPONENT_DELIMITER
          Delimiter for indirect subject components.
protected  boolean locked_
          Flag to make message immutable.
protected static java.lang.String NA_VALUE
          Not Applicable (not set) value.
protected  java.lang.String name_
          Message name.
protected static char NESTED_FIELD_END
          End delimiter for nested fields within string representation.
protected static char NESTED_FIELD_START
          Start delimiter for nested fields within string representation.
protected static java.lang.String NESTED_FIELDNAME_DELIMITER
          Delimiter for multiple subject specifications.
protected static boolean noCaseFldNames_
          Flag to indicate whether access to fields is done in a case-insensitive manner.
protected  java.util.Map noCaseFlds_
          Message fields - key into the Map is uppercase field names.
protected  java.util.List reqGrps_
          Required field groups.
protected static java.lang.String SUBJECT_DELIMITER
          Delimiter for multiple subject specifications.
protected static char SUBJECT_PARAM_END
          Delimiter for end of parameterized subject name component.
protected static char SUBJECT_PARAM_START
          Delimiter for start of parameterized subject name component.
protected static java.lang.String SUBJECT_WILDCARD
          Wildcard for parameterized subject name component - we use a
protected static java.util.Hashtable subjectParams_
          Subject specification parameters.
protected  java.lang.String[] subjectSpec_
          The send/listen subject specification for this message.
protected  java.lang.String[][] subjectSpecComponents_
          For each entry in subjectSpec_ this array contains the names of the parameterized components.
protected  java.lang.String version_
          Version field.
protected static java.lang.String XML_ATTR_NAME
          Attribute 'name' of JDOM element.
 
Constructor Summary
RMsg()
          Default constructor.
RMsg(java.lang.String name, java.lang.String desc)
          Constructor.
 
Method Summary
 void addBoolean(java.lang.String fldName, int fieldId, java.lang.String fldDesc)
          Add a boolean field.
 void addDate(java.lang.String fldName, int fieldId, java.lang.String fldDesc)
          GAdd a datetime field.
 void addDouble(java.lang.String fldName, int fieldId, java.lang.String fldDesc)
          Add a double field.
 void addField(RFld fld)
          Add a field to the message.
 void addFloat(java.lang.String fldName, int fieldId, java.lang.String fldDesc)
          Add a float field.
 void addInt(java.lang.String fldName, int fieldId, java.lang.String fldDesc)
          Add an integer field.
 void addLong(java.lang.String fldName, int fieldId, java.lang.String fldDesc)
          Get the value of a long field.
 void addMemo(java.lang.String fldName, int fieldId, java.lang.String fldDesc)
          Add a memo field.
 void addMsg(java.lang.String fldName, int fieldId, java.lang.String fldDesc)
          Add a TibrvMsg field.
 void addOpaque(java.lang.String fldName, int fieldId, java.lang.String fldDesc)
          Add an Opaque field.
protected  void addRequiredGrp(RRequiredGrp reqGrp)
          Add a required group to the message.
 void addShort(java.lang.String fldName, int fieldId, java.lang.String fldDesc)
          Add a short field.
 void addString(java.lang.String fldName, int fieldId, java.lang.String fldDesc)
          Add a string field.
 int apply(RFunctor func)
          Apply a functor to all fields in the message.
 boolean apply(RFunctor func, java.lang.String fldName)
          Apply a functor to a named field in the message.
 void clearSendSubject()
          Clears the send subject if it has been fixed.
 void createNested()
          Create nested fields in message.
 java.lang.Object[] diffFields(RMsg another)
          Compare this message with another source message and return the names of all fields in the other message that are either not in this message or are in this message but have a different field type.
protected  void doneAddingFields()
          This method allows subclasses to signal that all fields have been added to the message.
 boolean equalIgnoreValues(java.lang.Object anObject, java.util.Vector ignoreFields)
          Check if another message is equal to this message based on a subset of the fields in the messages.
 boolean equalIgnoreValuesDebug(java.lang.Object anObject, java.util.Vector ignoreFields)
          Check if another message is equal to this message based on a subset of the fields in the messages.
 boolean equals(java.lang.Object anObject)
          Check if another message is equal to this message.
 boolean equalsDebug(java.lang.Object anObject, java.lang.StringBuffer sbResultText)
          Check if another message is equal to this message.
 boolean equalsUsingTaggedFields(java.lang.Object anObject, java.lang.String tag, boolean ignoreCase)
          Check if another message is equal to this message.
 boolean fieldExists(java.lang.String fldName)
          Check if a named field exists in this message.
 java.lang.Object getBean(java.lang.String fldName)
          Get the value of a bean field.
 boolean getBoolean(java.lang.String fldName)
          Get the value of a boolean field.
 byte getByte(java.lang.String fldName)
          Get the value of a byte field.
 byte[] getBytes(java.lang.String fldName)
          Get the value of a opaque field.
 java.util.Date getDate(java.lang.String fldName)
          Get the value of a datetime field.
 java.lang.String getDesc()
          Get message description.
 double getDouble(java.lang.String fldName)
          Get the value of a double field.
 RFld getField(java.lang.String fldName)
          Get a named field from this message.
 int getFieldCount()
          Get the number of fields in this message.
 RFld getFieldIfExists(java.lang.String fldName)
          Get a named field from this message.
 java.util.Iterator getFieldNames()
          Get all names of all fields in the message.
 java.util.Iterator getFields()
          Get all fields in the message.
 RFld[] getFieldsAsArray()
          Get all fields in the message.
 java.lang.Object getFieldValueAsObject(java.lang.String fldName)
          Get the value of a field.
 java.lang.String getFieldValueAsString(java.lang.String fldName)
          Get field value as string.
 float getFloat(java.lang.String fldName)
          Get the value of a float field.
 int getInt(java.lang.String fldName)
          Get the value of a integer field.
 java.lang.String getListenSubject(boolean wildcard)
          Get the listen subject for this message.
 java.lang.String getListenSubject(java.util.Hashtable params, boolean wildcard)
          Get the listen subject for this message.
 java.lang.String[] getListenSubjects(boolean wildcard)
          Get the listen subjects for this message.
 java.lang.String[] getListenSubjects(java.util.Hashtable params, boolean wildcard)
          Get the listen subjects for this message.
 long getLong(java.lang.String fldName)
          Get the value of a long field.
 java.lang.String getMemo(java.lang.String fldName)
          Get the value of a memo field.
 java.lang.String getMsgVersion()
          Get message specification version.
 java.lang.String getName()
          Get message name.
protected  java.lang.Object getNestedFieldValueAsObject(java.lang.String fldName)
          Get the value of a field.
 byte[] getOpaque(java.lang.String fldName)
          Get the value of a Opaque field.
 java.lang.String getSendSubject()
          Get the send subject for this message.
 java.lang.String getSendSubject(java.util.Hashtable params)
          Get the send subject for this message.
 java.lang.String[] getSendSubjects()
          Get the send subjects for this message.
 java.lang.String[] getSendSubjects(java.util.Hashtable params)
          Get the send subjects for this message.
 short getShort(java.lang.String fldName)
          Get the value of a short field.
 java.lang.String getString(java.lang.String fldName)
          Get the value of a string field.
protected  java.lang.String[] getSubjects(java.util.Hashtable params, boolean wildcard)
          Build subjects for this message.
 java.lang.String[] getSubjectSpec()
          Get the subject specifications.
 java.util.List getTaggedFields(java.lang.String searchTag, boolean ignoreCase)
          Get a java.util.List with the names of all fields that have the specified search tag as one of their tags.
 java.lang.Object getTibrvMsg(java.lang.String fldName)
          Get the value of a TibrvMsg field.
 int hashCode()
          Similar to the comments for hashcode in java.util.Hashtable Returns the hash code value for the Message.
 boolean hasOneSubjectSpec()
          Determine if the message has exactly one subject specification.
 boolean isConstrained(java.lang.String fldName)
          Determine if the value of a named message has any constraints.
 boolean isEmptyMsg()
          Check if this is an empty message.
 boolean isLocked()
          Get Lock/Unlock property of the message object.
 boolean isLocked(java.lang.String fldName)
          Determine if a named message field is locked.
 boolean isSendSubjectFixed()
          Check if the send subject has been fixed.
 boolean isValSet(java.lang.String fldName)
          Determine if the value of a named message field has been set.
 void notRecuriveValidate()
          Validate message.
 void resetFields()
          Reset all unlocked fields in the message.
 void setBean(java.lang.String fldName, java.lang.Object val)
          Set the value of a bean field.
 void setBoolean(java.lang.String fldName, boolean val)
          Get the value of a boolean field.
 void setByte(java.lang.String fldName, byte val)
          Set the value of a byte field.
 void setBytes(java.lang.String fldName, byte[] val)
          Get the value of a opaque field.
 void setDate(java.lang.String fldName, java.util.Date val)
          Get the value of a datetime field.
 void setDate(java.lang.String fldName, long val)
          Get the value of a datetime field.
protected  void setDesc(java.lang.String desc)
          Set message description.
 void setDouble(java.lang.String fldName, double val)
          Set the value of a double field.
 void setEmptyMsg(boolean emptyMsg)
          Set the empty attribute of this message.
 void setFieldFromObject(java.lang.String fldName, java.lang.Object val)
          Set the value of a field from an object.
 void setFields(RMsg another)
          Set the field values of this message from another source message.
protected  void setFields(RMsg another, boolean ignoreConstrained)
          Set the field values of this message from another source message.
 void setFieldsIgnoreConstrained(RMsg another)
          Set the field values of this message from another source message.
 void setFloat(java.lang.String fldName, float val)
          Set the value of a float field.
 void setInt(java.lang.String fldName, int val)
          Set the value of a integer field.
 void setLocked(boolean locked)
          Lock/Unlock the message object and all its fields.
 void setLong(java.lang.String fldName, long val)
          Set the value of a long field.
 void setMemo(java.lang.String fldName, java.lang.String val)
          Set the value of a memo field.
protected  void setMsgVersion(java.lang.String version)
          Set message specification version number.
protected  void setName(java.lang.String name)
          Set message name.
 void setOpaque(java.lang.String fldName, byte[] val)
          Set the value of a Opaque field.
 void setSendSubject(java.lang.String fixedSendSubject)
          Set the send subject.
 void setShort(java.lang.String fldName, short val)
          Set the value of a short field.
 void setString(java.lang.String fldName, java.lang.String val)
          Set the value of a string field.
static void setSubjectParams(java.util.Hashtable params)
          Set subject parameters.
protected  void setSubjectSpec(java.lang.String[] subjectSpec, java.lang.String[][] subjectSpecComponents)
          Set the subject specification.
 void setTibrvMsg(java.lang.String fldName, java.lang.Object val)
          Set the value of a TibrvMsg field.
static void setXmlAttrNames(java.lang.String name)
          Register custom XML attribute names.
static void setXmlTag(java.lang.String newTag)
          Register custom XML field tag.
static void supportNoCaseFldNames(boolean val)
          Set the case-insensitive field name option.
 java.lang.String toPrettyPrintString()
          Get 'pretty print' string representation of message contents.
 java.lang.String toString()
          Get string representation of message contents.
 void validate()
          Validate message.
static java.lang.String validateFld(RFld fld, java.util.List outerFieldNameList)
          If the field contains another RMsg, then call validateMsg, otherwise just check if all not optional fields were set.
static java.lang.String validateMsg(RMsg msg, java.util.List outerFieldNameList)
          Recusively validiate the RMsg
 void validateRequiredGrps()
          Validate required field groups.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

version_

protected java.lang.String version_
Version field.


name_

protected java.lang.String name_
Message name.


desc_

protected java.lang.String desc_
Message description.


locked_

protected boolean locked_
Flag to make message immutable.


fixedSendSubject_

protected java.lang.String fixedSendSubject_
Fixed send subject. If the send subject is fixed by the application then the subject specification is ignored in comnputing the send subject.


subjectSpec_

protected java.lang.String[] subjectSpec_
The send/listen subject specification for this message. The subject specification can either be static - e.g. UM.ADMIN, or parameterized - e.g. UM.[ClientId].ADMIN. If the subject is parameterized then the parameters must be the names of String fields in the message. Multiple send/listen subjects may be specified by provided a comma separated list of send subjects - e.g. UM.ADMIN,UM.[ClientId].ADMIN.


subjectSpecComponents_

protected java.lang.String[][] subjectSpecComponents_
For each entry in subjectSpec_ this array contains the names of the parameterized components. For example, if subjectSpec_[0] is FB.FE.[ClientId].[UserId].ORD then subjectSpecComponents_[0] will contain twl elements - ClientId and UserId.


flds_

protected java.util.Map flds_
Message fields.


fldsArray_

protected transient RFld[] fldsArray_

noCaseFlds_

protected java.util.Map noCaseFlds_
Message fields - key into the Map is uppercase field names.


emptyMsg_

protected boolean emptyMsg_
Field to indicate if this message has no fields.


reqGrps_

protected java.util.List reqGrps_
Required field groups.

See Also:
RRequiredGrp

subjectParams_

protected static transient java.util.Hashtable subjectParams_
Subject specification parameters.


INDIRECT_COMPONENT_DELIMITER

protected static final transient char INDIRECT_COMPONENT_DELIMITER
Delimiter for indirect subject components.

See Also:
Constant Field Values

NESTED_FIELDNAME_DELIMITER

protected static final transient java.lang.String NESTED_FIELDNAME_DELIMITER
Delimiter for multiple subject specifications.

See Also:
Constant Field Values

SUBJECT_DELIMITER

protected static final transient java.lang.String SUBJECT_DELIMITER
Delimiter for multiple subject specifications.

See Also:
Constant Field Values

SUBJECT_PARAM_START

protected static final transient char SUBJECT_PARAM_START
Delimiter for start of parameterized subject name component.

See Also:
Constant Field Values

SUBJECT_PARAM_END

protected static final transient char SUBJECT_PARAM_END
Delimiter for end of parameterized subject name component.

See Also:
Constant Field Values

SUBJECT_WILDCARD

protected static final transient java.lang.String SUBJECT_WILDCARD
Wildcard for parameterized subject name component - we use a

See Also:
Constant Field Values

EXPOSED_FIELD_DELIMITER

protected static final transient char EXPOSED_FIELD_DELIMITER
Delimiter for exposed fields within string representation.

See Also:
Constant Field Values

HASHTABLE_ENTRY_DELIMITER

protected static final transient char HASHTABLE_ENTRY_DELIMITER
Delimiter for fields within hashtable entry string representation.

See Also:
Constant Field Values

NESTED_FIELD_START

protected static final transient char NESTED_FIELD_START
Start delimiter for nested fields within string representation.

See Also:
Constant Field Values

NESTED_FIELD_END

protected static final transient char NESTED_FIELD_END
End delimiter for nested fields within string representation.

See Also:
Constant Field Values

FIELD_EQUAL

protected static final transient char FIELD_EQUAL
End delimiter for nested fields within string representation.

See Also:
Constant Field Values

NA_VALUE

protected static final transient java.lang.String NA_VALUE
Not Applicable (not set) value.

See Also:
Constant Field Values

XML_ATTR_NAME

protected static transient java.lang.String XML_ATTR_NAME
Attribute 'name' of JDOM element.


noCaseFldNames_

protected static transient boolean noCaseFldNames_
Flag to indicate whether access to fields is done in a case-insensitive manner. Default is true.

Constructor Detail

RMsg

public RMsg()
Default constructor. Sets the empty message flag to true.

See Also:
setEmptyMsg(boolean)

RMsg

public RMsg(java.lang.String name,
            java.lang.String desc)
Constructor.

Parameters:
name - Message name.
desc - Description of message.
Method Detail

createNested

public void createNested()
Create nested fields in message. All fields in the message are of type MSGOBJ or BEAN are created if not already set.


getFields

public final java.util.Iterator getFields()
Get all fields in the message.

Specified by:
getFields in interface RMapMessage
Returns:
Iterator of all RFld fields in the message.
See Also:
RMapMessage.getFieldsAsArray()

getFieldsAsArray

public final RFld[] getFieldsAsArray()
Get all fields in the message.

Specified by:
getFieldsAsArray in interface RMapMessage
Returns:
Array of all RFld fields in the message.
See Also:
RMapMessage.getFields()

doneAddingFields

protected final void doneAddingFields()
This method allows subclasses to signal that all fields have been added to the message. All subclasses should call this method after adding all fields to the message.


getTaggedFields

public final java.util.List getTaggedFields(java.lang.String searchTag,
                                            boolean ignoreCase)
Get a java.util.List with the names of all fields that have the specified search tag as one of their tags.

Parameters:
searchTag - Search tag. If the search tag is null then the names of all fields that do not have any tags are returned.
ignoreCase - Case insensitive tag compare is performed if this paramater is true. Otherwise, case sensitive tag compare is performed.
Returns:
java.util.List with the names of all fields whose tag matches the specified search tag.
See Also:
RFld.getTags(), RFld.setTags(String[])

resetFields

public final void resetFields()
Reset all unlocked fields in the message.

See Also:
RFld.isLocked(), RFld.reset()

setFields

public final void setFields(RMsg another)
                     throws FieldValidationException
Set the field values of this message from another source message. A field in the source object will be copied if there is a field in the this object with the same name, and the source field has been set, and the target field is not locked. An implicit assumption is that if the source and the target have fields with the same name, then the types of the fields are the same - if this assumption is violated then an exception is thrown.

Parameters:
another - Source message.
Throws:
FieldValidationException
See Also:
RFld.getType(), setFieldsIgnoreConstrained(RMsg)

setFieldsIgnoreConstrained

public final void setFieldsIgnoreConstrained(RMsg another)
                                      throws FieldValidationException
Set the field values of this message from another source message. Fields in this message that have constraints are ignored. A field in the source object will be copied if there is a field in the this object with the same name, and the source field has been set, and the target field is not locked. An implicit assumption is that if the source and the target have fields with the same name, then the types of the fields are the same - if this assumption is violated then an exception is thrown.

Parameters:
another - Source message.
Throws:
FieldValidationException
See Also:
RFld.getType(), setFields(RMsg)

setFields

protected final void setFields(RMsg another,
                               boolean ignoreConstrained)
                        throws FieldValidationException
Set the field values of this message from another source message. A field in the source object will be copied if there is a field in the this object with the same name, and the source field has been set, and the target field is not locked. An implicit assumption is that if the source and the target have fields with the same name, then the types of the fields are the same - if this assumption is violated then an exception is thrown.

Parameters:
another - Source message.
ignoreConstrained - Flagh to indicate whether constrained fields should be ignored. If true then fields that have constraints are not set.
Throws:
FieldValidationException
See Also:
RFld.getType()

diffFields

public final java.lang.Object[] diffFields(RMsg another)
                                    throws FieldValidationException
Compare this message with another source message and return the names of all fields in the other message that are either not in this message or are in this message but have a different field type.

Parameters:
another - Source message.
Returns:
Array of field names.
Throws:
FieldValidationException
See Also:
RFld.getType()

getName

public final java.lang.String getName()
Get message name.

Specified by:
getName in interface RMapMessage
Returns:
Message name.

setName

protected final void setName(java.lang.String name)
Set message name.

Parameters:
name - Message name.

getDesc

public final java.lang.String getDesc()
Get message description.

Returns:
Message description.

setDesc

protected final void setDesc(java.lang.String desc)
Set message description.

Parameters:
desc - Message description.

addField

public final void addField(RFld fld)
                    throws FieldValidationException
Add a field to the message.

Specified by:
addField in interface RMapMessage
Parameters:
fld - Field to add to message.
Throws:
FieldValidationException
See Also:
RFld

addRequiredGrp

protected final void addRequiredGrp(RRequiredGrp reqGrp)
Add a required group to the message.

Parameters:
reqGrp - Required group.
Throws:
java.lang.IllegalArgumentException - if required group is null.
See Also:
RRequiredGrp

validate

public final void validate()
                    throws FieldValidationException
Validate message. A message is valid if all its non-optional fields have been set.

Throws:
FieldValidationException

notRecuriveValidate

public final void notRecuriveValidate()
                               throws FieldValidationException
Validate message. A message is valid if all its non-optional fields have been set.

Throws:
FieldValidationException

validateMsg

public static java.lang.String validateMsg(RMsg msg,
                                           java.util.List outerFieldNameList)
Recusively validiate the RMsg

Parameters:
msg - The RMsg to validate
outerFieldNameList - a way to keep track of the fieldname during recursion.
Returns:
Returns error if any field in message in invalid. Returns empty string if message is valid.

validateFld

public static java.lang.String validateFld(RFld fld,
                                           java.util.List outerFieldNameList)
If the field contains another RMsg, then call validateMsg, otherwise just check if all not optional fields were set.

Parameters:
fld - The RFld to validate.
outerFieldNameList - a way to keep track of the fieldname during recursion.

validateRequiredGrps

public final void validateRequiredGrps()
                                throws FieldValidationException
Validate required field groups.

Throws:
FieldValidationException

apply

public final int apply(RFunctor func)
                throws FieldValidationException
Apply a functor to all fields in the message.

Specified by:
apply in interface RMapMessage
Parameters:
func - Functor
Returns:
The number of fields to which the functor was applied.
Throws:
FieldValidationException
See Also:
RFunctor

apply

public final boolean apply(RFunctor func,
                           java.lang.String fldName)
                    throws FieldValidationException
Apply a functor to a named field in the message.

Specified by:
apply in interface RMapMessage
Parameters:
func - Functor.
fldName - Field name.
Returns:
true if the named field was found and the functor was applied to it.
Throws:
FieldValidationException
See Also:
RFunctor

getFieldIfExists

public final RFld getFieldIfExists(java.lang.String fldName)
                            throws FieldValidationException
Get a named field from this message. Returns null if the named field is not in the message. Either there is an exact match for the field name, or, case-insentitive names are enabled and there is a case-insensitive field name match.

Specified by:
getFieldIfExists in interface RMapMessage
Parameters:
fldName - Field name.
Returns:
Named field.
Throws:
FieldValidationException

getField

public final RFld getField(java.lang.String fldName)
                    throws FieldValidationException
Get a named field from this message. Throws an exception if the named field is not in the message. Either there is an exact match for the field name, or, case-insentitive names are enabled and there is a case-insensitive field name match.

Specified by:
getField in interface RMapMessage
Parameters:
fldName - Field name.
Returns:
Named field.
Throws:
FieldValidationException

isLocked

public final boolean isLocked()
Get Lock/Unlock property of the message object. If a message is locked then all the setter methods are disabled.

Returns:
Returns true if object is locked. Otherwise, returns false.

setLocked

public final void setLocked(boolean locked)
Lock/Unlock the message object and all its fields.

Parameters:
locked - true to lock the object. Otherwise, false to unlock the object.

isSendSubjectFixed

public final boolean isSendSubjectFixed()
Check if the send subject has been fixed.

Returns:
Returns true if the send subject has been fixed. Otherwise, returns false.
See Also:
setSendSubject(String), clearSendSubject()

clearSendSubject

public final void clearSendSubject()
Clears the send subject if it has been fixed.

See Also:
isSendSubjectFixed(), setSendSubject(String)

setSendSubject

public final void setSendSubject(java.lang.String fixedSendSubject)
Set the send subject. Once the send subject has been fixed, it is not re-computed at run time, and is instead used for single and multiple send subjects.

Parameters:
fixedSendSubject - Fixed send subject.
See Also:
isSendSubjectFixed(), clearSendSubject()

setSubjectParams

public static final void setSubjectParams(java.util.Hashtable params)
Set subject parameters.

Parameters:
params - Map of parameter placeholder values. Key into the hashtable is the name of the placeholder and the value is the value of the placeholder. Parameter values in this parameter override field value substitution.
For example, suppose the parameterized subject specification is UM.[ClientId].ADMIN, and the message has a field named ClientId with value JPM. If a key/value ClientId/BARZ is passed here then the send subject will be UM.BARZ.ADMIN. If the key/value is not passed then the send subject will be UM.JPM.ADMIN.
See Also:
setSendSubject(String), getSendSubject(), getSendSubject(java.util.Hashtable), getSendSubjects(), getSendSubjects(java.util.Hashtable), getListenSubject(boolean), getListenSubject(java.util.Hashtable, boolean), getListenSubjects(boolean), getListenSubjects(java.util.Hashtable, boolean)

hasOneSubjectSpec

public final boolean hasOneSubjectSpec()
Determine if the message has exactly one subject specification.

Returns:
Returns true if the message has exactly one subject specification. Returns false if the message has zero or more than one subject specification.
See Also:
setSendSubject(String), getSendSubject(), getSendSubject(java.util.Hashtable), getSendSubjects(), getSendSubjects(java.util.Hashtable), getListenSubject(boolean), getListenSubject(java.util.Hashtable, boolean), getListenSubjects(boolean), getListenSubjects(java.util.Hashtable, boolean)

setSubjectSpec

protected final void setSubjectSpec(java.lang.String[] subjectSpec,
                                    java.lang.String[][] subjectSpecComponents)
Set the subject specification. More then one subject specification can be set with each specification separated by the SUBJECT_DELIMITER.

Parameters:
subjectSpec - One or more subject specifications separated by SUBJECT_DELIMITER.
See Also:
setSendSubject(String), getSendSubject(), getSendSubject(java.util.Hashtable), getSendSubjects(), getSendSubjects(java.util.Hashtable), getListenSubject(boolean), getListenSubject(java.util.Hashtable, boolean), getListenSubjects(boolean), getListenSubjects(java.util.Hashtable, boolean), SUBJECT_DELIMITER

getSubjectSpec

public final java.lang.String[] getSubjectSpec()
Get the subject specifications.

Returns:
Subject specifications.
See Also:
setSendSubject(String), getSendSubject(), getSendSubject(java.util.Hashtable), getSendSubjects(), getSendSubjects(java.util.Hashtable), getListenSubject(boolean), getListenSubject(java.util.Hashtable, boolean), getListenSubjects(boolean), getListenSubjects(java.util.Hashtable, boolean)

getSendSubject

public final java.lang.String getSendSubject()
                                      throws MsgValidationException
Get the send subject for this message. Throws an exception if the message does not have exactly one send subject.

Returns:
Send subject for this message.
Throws:
MsgValidationException
See Also:
setSendSubject(String), getSendSubject(java.util.Hashtable), getSendSubjects(), getSendSubjects(java.util.Hashtable), getListenSubject(boolean), getListenSubject(java.util.Hashtable, boolean), getListenSubjects(boolean), getListenSubjects(java.util.Hashtable, boolean)

getSendSubject

public final java.lang.String getSendSubject(java.util.Hashtable params)
                                      throws MsgValidationException
Get the send subject for this message. Throws an exception if the message does not have exactly one send subject.

Parameters:
params - Map of parameter placeholder values. Key into the hashtable is the name of the placeholder and the value is the value of the placeholder. Parameter values in this parameter override field value substitution.
For example, suppose the parameterized subject specification is UM.[ClientId].ADMIN, and the message has a field named ClientId with value JPM. If a key/value ClientId/BARZ is passed here then the send subject will be UM.BARZ.ADMIN. If the key/value is not passed then the send subject will be UM.JPM.ADMIN.
Returns:
Send subject for this message.
Throws:
MsgValidationException
See Also:
setSendSubject(String), getSendSubject(), getSendSubjects(), getSendSubjects(java.util.Hashtable), getListenSubject(boolean), getListenSubject(java.util.Hashtable, boolean), getListenSubjects(boolean), getListenSubjects(java.util.Hashtable, boolean)

getSendSubjects

public final java.lang.String[] getSendSubjects()
                                         throws MsgValidationException
Get the send subjects for this message. Throws an exception if the message does not have any send subjects.

Returns:
Send subject for this message.
Throws:
MsgValidationException
See Also:
setSendSubject(String), getSendSubject(), getSendSubject(java.util.Hashtable), getSendSubjects(java.util.Hashtable), getListenSubject(boolean), getListenSubject(java.util.Hashtable, boolean), getListenSubjects(boolean), getListenSubjects(java.util.Hashtable, boolean)

getSendSubjects

public final java.lang.String[] getSendSubjects(java.util.Hashtable params)
                                         throws MsgValidationException
Get the send subjects for this message. Throws an exception if the message does not have any send subject.

Parameters:
params - Map of parameter placeholder values. Key into the hashtable is the name of the placeholder and the value is the value of the placeholder. Parameter values in this parameter override field value substitution.
For example, suppose the parameterized subject specification is UM.[ClientId].ADMIN, and the message has a field named ClientId with value JPM. If a key/value ClientId/BARZ is passed here then the send subject will be UM.BARZ.ADMIN. If the key/value is not passed then the send subject will be UM.JPM.ADMIN.
Returns:
Send subjects for this message.
Throws:
MsgValidationException
See Also:
setSendSubject(String), getSendSubject(), getSendSubject(java.util.Hashtable), getSendSubjects(), getListenSubject(boolean), getListenSubject(java.util.Hashtable, boolean), getListenSubjects(boolean), getListenSubjects(java.util.Hashtable, boolean)

getListenSubject

public final java.lang.String getListenSubject(boolean wildcard)
                                        throws MsgValidationException
Get the listen subject for this message. Throws an exception if the message does not have exactly one listen subject.

Parameters:
wildcard - If true all parameterized components in the subject specification are converted into wildcard '*'.
Returns:
Listen subjects for this message.
Throws:
MsgValidationException
See Also:
setSendSubject(String), getSendSubject(), getSendSubject(java.util.Hashtable), getSendSubjects(), getSendSubjects(java.util.Hashtable), getListenSubject(java.util.Hashtable, boolean), getListenSubjects(boolean), getListenSubjects(java.util.Hashtable, boolean)

getListenSubject

public final java.lang.String getListenSubject(java.util.Hashtable params,
                                               boolean wildcard)
                                        throws MsgValidationException
Get the listen subject for this message. Throws an exception if the message does not have exactly one listen subject.

Parameters:
params - Map of parameter placeholder values. Key into the hashtable is the name of the placeholder and the value is the value of the placeholder. Values in this parameter override field value substitution.
For example, suppose the parameterized subject specification is UM.[ClientId].ADMIN, and the message has a field named ClientId with value JPM. If a key/value ClientId/BARZ is passed here then the listen subject will be UM.BARZ.ADMIN. If the key/value is not passed then the listen subject will be UM.JPM.ADMIN.
wildcard - If true all parameterized components in the subject specification are converted into wildcard '*'.
Returns:
Listen subjects for this message.
Throws:
MsgValidationException
See Also:
setSendSubject(String), getSendSubject(), getSendSubject(java.util.Hashtable), getSendSubjects(), getSendSubjects(java.util.Hashtable), getListenSubject(boolean), getListenSubjects(boolean), getListenSubjects(java.util.Hashtable, boolean)

getListenSubjects

public final java.lang.String[] getListenSubjects(boolean wildcard)
                                           throws MsgValidationException
Get the listen subjects for this message. Throws an exception if the message does not have any listen subject.

Parameters:
wildcard - If true all parameterized components in the subject specification are converted into wildcard '*'.
Returns:
Listen subjects for this message.
Throws:
MsgValidationException
See Also:
setSendSubject(String), getSendSubject(), getSendSubject(java.util.Hashtable), getSendSubjects(), getSendSubjects(java.util.Hashtable), getListenSubject(boolean), getListenSubject(java.util.Hashtable, boolean), getListenSubjects(java.util.Hashtable, boolean)

getListenSubjects

public final java.lang.String[] getListenSubjects(java.util.Hashtable params,
                                                  boolean wildcard)
                                           throws MsgValidationException
Get the listen subjects for this message. Throws an exception if the message does not have exactly any listen subject.

Parameters:
params - Map of parameter placeholder values. Key into the hashtable is the name of the placeholder and the value is the value of the placeholder. Values in this parameter override field value substitution.
For example, suppose the parameterized subject specification is UM.[ClientId].ADMIN, and the message has a field named ClientId with value JPM. If a key/value ClientId/BARZ is passed here then the listen subject will be UM.BARZ.ADMIN. If the key/value is not passed then the listen subject will be UM.JPM.ADMIN.
wildcard - If true all parameterized components in the subject specification are converted into wildcard '*'.
Returns:
Listen subjects for this message.
Throws:
MsgValidationException
See Also:
setSendSubject(String), getSendSubject(), getSendSubject(java.util.Hashtable), getSendSubjects(), getSendSubjects(java.util.Hashtable), getListenSubject(boolean), getListenSubject(java.util.Hashtable, boolean), getListenSubjects(boolean)

getSubjects

protected final java.lang.String[] getSubjects(java.util.Hashtable params,
                                               boolean wildcard)
                                        throws MsgValidationException
Build subjects for this message.

Parameters:
params -
wildcard - Flag to indicate if parameterized subject components should be converted to wildcard '*'. If true then all the parameterized subject components are converted to wildcard.
Returns:
Subjects for this message. Returns zero length array if the message does not have any subject specification.
Throws:
MsgValidationException

getMsgVersion

public final java.lang.String getMsgVersion()
Get message specification version.

Returns:
Message specification version number. If version is not defined, returns null.

setMsgVersion

protected final void setMsgVersion(java.lang.String version)
Set message specification version number.

Parameters:
version - Message specification version number.

getFieldValueAsObject

public final java.lang.Object getFieldValueAsObject(java.lang.String fldName)
                                             throws FieldValidationException
Get the value of a field. A reference to the data is returned so be careful about modifying the data through the reference. For fields nested within RFldTibrvMsg (TibrvMsg) fields the name can be a dot notation field name.

Specified by:
getFieldValueAsObject in interface RMapMessage
Parameters:
fldName - Field name.
Returns:
Field value.
Throws:
FieldValidationException
See Also:
RFld, RFldTibrvMsg.getValueAsObject(String, String)

getNestedFieldValueAsObject

protected final java.lang.Object getNestedFieldValueAsObject(java.lang.String fldName)
                                                      throws FieldValidationException
Get the value of a field. A reference to the data is returned so be careful about modifying the data through the reference.

Parameters:
fldName - Field name.
Returns:
Field value.
Throws:
FieldValidationException
See Also:
RFld

getFieldValueAsString

public final java.lang.String getFieldValueAsString(java.lang.String fldName)
                                             throws FieldValidationException
Get field value as string.

Specified by:
getFieldValueAsString in interface RMapMessage
Parameters:
fldName - Field name.
Returns:
Field value.
Throws:
FieldValidationException

getTibrvMsg

public final java.lang.Object getTibrvMsg(java.lang.String fldName)
                                   throws FieldValidationException
Get the value of a TibrvMsg field. A reference to the data is returned so be careful about modifying the data through the reference.

Specified by:
getTibrvMsg in interface RMapMessage
Parameters:
fldName - Field name.
Returns:
Field value.
Throws:
FieldValidationException
See Also:
RFldTibrvMsg

getOpaque

public final byte[] getOpaque(java.lang.String fldName)
                       throws FieldValidationException
Get the value of a Opaque field. A reference to the data is returned so be careful about modifying the data through the reference.

Specified by:
getOpaque in interface RMapMessage
Parameters:
fldName - Field name.
Returns:
Field value.
Throws:
FieldValidationException
See Also:
RFldOpaque

getDate

public final java.util.Date getDate(java.lang.String fldName)
                             throws FieldValidationException
Get the value of a datetime field. A reference to the data is returned so be careful about modifying the data through the reference.

Specified by:
getDate in interface RMapMessage
Parameters:
fldName - Field name.
Returns:
Field value.
Throws:
FieldValidationException
See Also:
RFldDatetime

getBoolean

public final boolean getBoolean(java.lang.String fldName)
                         throws FieldValidationException
Get the value of a boolean field.

Specified by:
getBoolean in interface RMapMessage
Parameters:
fldName - Field name.
Returns:
Field value.
Throws:
FieldValidationException
See Also:
RFldBool

getBytes

public final byte[] getBytes(java.lang.String fldName)
                      throws FieldValidationException
Get the value of a opaque field. A reference to the data is returned so be careful about modifying the data through the reference.

Specified by:
getBytes in interface RMapMessage
Parameters:
fldName - Field name.
Returns:
Field value.
Throws:
FieldValidationException
See Also:
RFldOpaque

getFloat

public final float getFloat(java.lang.String fldName)
                     throws FieldValidationException
Get the value of a float field.

Specified by:
getFloat in interface RMapMessage
Parameters:
fldName - Field name.
Returns:
Field value.
Throws:
FieldValidationException
See Also:
RFldF32

getDouble

public final double getDouble(java.lang.String fldName)
                       throws FieldValidationException
Get the value of a double field.

Specified by:
getDouble in interface RMapMessage
Parameters:
fldName - Field name.
Returns:
Field value.
Throws:
FieldValidationException
See Also:
RFldF64

getByte

public final byte getByte(java.lang.String fldName)
                   throws FieldValidationException
Get the value of a byte field.

Specified by:
getByte in interface RMapMessage
Parameters:
fldName - Field name.
Returns:
Field value.
Throws:
FieldValidationException
See Also:
RFldI8

getShort

public final short getShort(java.lang.String fldName)
                     throws FieldValidationException
Get the value of a short field.

Specified by:
getShort in interface RMapMessage
Parameters:
fldName - Field name.
Returns:
Field value.
Throws:
FieldValidationException
See Also:
RFldI16

getInt

public final int getInt(java.lang.String fldName)
                 throws FieldValidationException
Get the value of a integer field.

Specified by:
getInt in interface RMapMessage
Parameters:
fldName - Field name.
Returns:
Field value.
Throws:
FieldValidationException
See Also:
RFldI32

getLong

public final long getLong(java.lang.String fldName)
                   throws FieldValidationException
Get the value of a long field.

Specified by:
getLong in interface RMapMessage
Parameters:
fldName - Field name.
Returns:
Field value.
Throws:
FieldValidationException
See Also:
RFldI64

getBean

public final java.lang.Object getBean(java.lang.String fldName)
                               throws FieldValidationException
Get the value of a bean field.

Parameters:
fldName - Field name.
Returns:
Field value.
Throws:
FieldValidationException
See Also:
RFldBean

getString

public final java.lang.String getString(java.lang.String fldName)
                                 throws FieldValidationException
Get the value of a string field.

Specified by:
getString in interface RMapMessage
Parameters:
fldName - Field name.
Returns:
Field value.
Throws:
FieldValidationException
See Also:
RFldString

getMemo

public final java.lang.String getMemo(java.lang.String fldName)
                               throws FieldValidationException
Get the value of a memo field.

Specified by:
getMemo in interface RMapMessage
Parameters:
fldName - Field name.
Returns:
Field value.
Throws:
FieldValidationException
See Also:
RFldMemo

addMsg

public final void addMsg(java.lang.String fldName,
                         int fieldId,
                         java.lang.String fldDesc)
                  throws FieldValidationException
Add a TibrvMsg field.

Parameters:
fldName - Field name.
fieldId - Field Id. 0 means the field has no id.
fldDesc - Field description. Can be null.
Throws:
FieldValidationException
See Also:
RFldTibrvMsg

addOpaque

public final void addOpaque(java.lang.String fldName,
                            int fieldId,
                            java.lang.String fldDesc)
                     throws FieldValidationException
Add an Opaque field.

Parameters:
fldName - Field name.
fieldId - Field Id. 0 means the field has no id.
fldDesc - Field description. Can be null.
Throws:
FieldValidationException
See Also:
RFldOpaque

addDate

public final void addDate(java.lang.String fldName,
                          int fieldId,
                          java.lang.String fldDesc)
                   throws FieldValidationException
GAdd a datetime field.

Parameters:
fldName - Field name.
fieldId - Field Id. 0 means the field has no id.
fldDesc - Field description. Can be null.
Throws:
FieldValidationException
See Also:
RFldDatetime

addBoolean

public final void addBoolean(java.lang.String fldName,
                             int fieldId,
                             java.lang.String fldDesc)
                      throws FieldValidationException
Add a boolean field.

Parameters:
fldName - Field name.
fieldId - Field Id. 0 means the field has no id.
fldDesc - Field description. Can be null.
Throws:
FieldValidationException
See Also:
RFldBool

addFloat

public final void addFloat(java.lang.String fldName,
                           int fieldId,
                           java.lang.String fldDesc)
                    throws FieldValidationException
Add a float field.

Parameters:
fldName - Field name.
fieldId - Field Id. 0 means the field has no id.
fldDesc - Field description. Can be null.
Throws:
FieldValidationException
See Also:
RFldF32

addDouble

public final void addDouble(java.lang.String fldName,
                            int fieldId,
                            java.lang.String fldDesc)
                     throws FieldValidationException
Add a double field.

Parameters:
fldName - Field name.
fieldId - Field Id. 0 means the field has no id.
fldDesc - Field description. Can be null.
Throws:
FieldValidationException
See Also:
RFldF64

addShort

public final void addShort(java.lang.String fldName,
                           int fieldId,
                           java.lang.String fldDesc)
                    throws FieldValidationException
Add a short field.

Parameters:
fldName - Field name.
fieldId - Field Id. 0 means the field has no id.
fldDesc - Field description. Can be null.
Throws:
FieldValidationException
See Also:
RFldI16

addInt

public final void addInt(java.lang.String fldName,
                         int fieldId,
                         java.lang.String fldDesc)
                  throws FieldValidationException
Add an integer field.

Parameters:
fldName - Field name.
fieldId - Field Id. 0 means the field has no id.
fldDesc - Field description. Can be null.
Throws:
FieldValidationException
See Also:
RFldI32

addLong

public final void addLong(java.lang.String fldName,
                          int fieldId,
                          java.lang.String fldDesc)
                   throws FieldValidationException
Get the value of a long field.

Parameters:
fldName - Field name.
fieldId - Field Id. 0 means the field has no id.
fldDesc - Field description. Can be null.
Throws:
FieldValidationException
See Also:
RFldI64

addString

public final void addString(java.lang.String fldName,
                            int fieldId,
                            java.lang.String fldDesc)
                     throws FieldValidationException
Add a string field.

Parameters:
fldName - Field name.
fieldId - Field Id. 0 means the field has no id.
fldDesc - Field description. Can be null.
Throws:
FieldValidationException
See Also:
RFldString

addMemo

public final void addMemo(java.lang.String fldName,
                          int fieldId,
                          java.lang.String fldDesc)
                   throws FieldValidationException
Add a memo field.

Parameters:
fldName - Field name.
fieldId - Field Id. 0 means the field has no id.
fldDesc - Field description. Can be null.
Throws:
FieldValidationException
See Also:
RFldMemo

setTibrvMsg

public final void setTibrvMsg(java.lang.String fldName,
                              java.lang.Object val)
                       throws FieldValidationException
Set the value of a TibrvMsg field.

Specified by:
setTibrvMsg in interface RMapMessage
Parameters:
fldName - Field name.
val - Field value.
Throws:
FieldValidationException
See Also:
RFldTibrvMsg

setOpaque

public final void setOpaque(java.lang.String fldName,
                            byte[] val)
                     throws FieldValidationException
Set the value of a Opaque field.

Specified by:
setOpaque in interface RMapMessage
Parameters:
fldName - Field name.
val - Field value.
Throws:
FieldValidationException
See Also:
RFldOpaque

setDate

public final void setDate(java.lang.String fldName,
                          java.util.Date val)
                   throws FieldValidationException
Get the value of a datetime field.

Specified by:
setDate in interface RMapMessage
Parameters:
fldName - Field name.
val - value.
Throws:
FieldValidationException
See Also:
RFldDatetime

setDate

public final void setDate(java.lang.String fldName,
                          long val)
                   throws FieldValidationException
Get the value of a datetime field.

Specified by:
setDate in interface RMapMessage
Parameters:
fldName - Field name.
val - value.
Throws:
FieldValidationException
See Also:
RFldDatetime

setBoolean

public final void setBoolean(java.lang.String fldName,
                             boolean val)
                      throws FieldValidationException
Get the value of a boolean field.

Specified by:
setBoolean in interface RMapMessage
Parameters:
fldName - Field name.
val - Field value.
Throws:
FieldValidationException
See Also:
RFldBool

setBytes

public final void setBytes(java.lang.String fldName,
                           byte[] val)
                    throws FieldValidationException
Get the value of a opaque field.

Specified by:
setBytes in interface RMapMessage
Parameters:
fldName - Field name.
val - Field value.
Throws:
FieldValidationException
See Also:
RFldOpaque

setFloat

public final void setFloat(java.lang.String fldName,
                           float val)
                    throws FieldValidationException
Set the value of a float field.

Specified by:
setFloat in interface RMapMessage
Parameters:
fldName - Field name.
val - Field value.
Throws:
FieldValidationException
See Also:
RFldF32

setDouble

public final void setDouble(java.lang.String fldName,
                            double val)
                     throws FieldValidationException
Set the value of a double field.

Specified by:
setDouble in interface RMapMessage
Parameters:
fldName - Field name.
val - Field value.
Throws:
FieldValidationException
See Also:
RFldF64

setByte

public final void setByte(java.lang.String fldName,
                          byte val)
                   throws FieldValidationException
Set the value of a byte field.

Parameters:
fldName - Field name.
val - Field value.
Throws:
FieldValidationException
See Also:
RFldI8

setShort

public final void setShort(java.lang.String fldName,
                           short val)
                    throws FieldValidationException
Set the value of a short field.

Specified by:
setShort in interface RMapMessage
Parameters:
fldName - Field name.
val - Field value.
Throws:
FieldValidationException
See Also:
RFldI16

setInt

public final void setInt(java.lang.String fldName,
                         int val)
                  throws FieldValidationException
Set the value of a integer field.

Specified by:
setInt in interface RMapMessage
Parameters:
fldName - Field name.
val - Field value.
Throws:
FieldValidationException
See Also:
RFldI32

setLong

public final void setLong(java.lang.String fldName,
                          long val)
                   throws FieldValidationException
Set the value of a long field.

Specified by:
setLong in interface RMapMessage
Parameters:
fldName - Field name.
val - Field value.
Throws:
FieldValidationException
See Also:
RFldI64

setFieldFromObject

public final void setFieldFromObject(java.lang.String fldName,
                                     java.lang.Object val)
                              throws FieldValidationException
Set the value of a field from an object.

Specified by:
setFieldFromObject in interface RMapMessage
Parameters:
fldName - Field name.
val - Field value.
Throws:
FieldValidationException
See Also:
RFld

setBean

public final void setBean(java.lang.String fldName,
                          java.lang.Object val)
                   throws FieldValidationException
Set the value of a bean field.

Parameters:
fldName - Field name.
val - Field value.
Throws:
FieldValidationException
See Also:
RFldString

setString

public final void setString(java.lang.String fldName,
                            java.lang.String val)
                     throws FieldValidationException
Set the value of a string field.

Specified by:
setString in interface RMapMessage
Parameters:
fldName - Field name.
val - Field value.
Throws:
FieldValidationException
See Also:
RFldString

setMemo

public final void setMemo(java.lang.String fldName,
                          java.lang.String val)
                   throws FieldValidationException
Set the value of a memo field.

Specified by:
setMemo in interface RMapMessage
Parameters:
fldName - Field name.
val - Field value.
Throws:
FieldValidationException
See Also:
RFldMemo

fieldExists

public final boolean fieldExists(java.lang.String fldName)
Check if a named field exists in this message. Either there is an exact match for the field name, or, case-insentitive names are enabled and there is a case-insensitive field name match.

Specified by:
fieldExists in interface RMapMessage
Parameters:
fldName - Field name.
Returns:
true if the named field exists. Otherwise returns false.

isValSet

public final boolean isValSet(java.lang.String fldName)
                       throws FieldValidationException
Determine if the value of a named message field has been set.

Specified by:
isValSet in interface RMapMessage
Parameters:
fldName - Field name.
Returns:
true if the value of a named message field has been set. Otherwise, returns false.
Throws:
FieldValidationException

isConstrained

public final boolean isConstrained(java.lang.String fldName)
                            throws FieldValidationException
Determine if the value of a named message has any constraints.

Specified by:
isConstrained in interface RMapMessage
Parameters:
fldName - Field name.
Returns:
true if the value of a named message field has been constrained. Otherwise, returns false.
Throws:
FieldValidationException

isLocked

public final boolean isLocked(java.lang.String fldName)
                       throws FieldValidationException
Determine if a named message field is locked.

Specified by:
isLocked in interface RMapMessage
Parameters:
fldName - Field name.
Returns:
true if the named field is locked. Otherwise, returns false.
Throws:
FieldValidationException

getFieldCount

public final int getFieldCount()
Get the number of fields in this message.

Returns:
Number of fields in this message.

getFieldNames

public final java.util.Iterator getFieldNames()
Get all names of all fields in the message.

Specified by:
getFieldNames in interface RMapMessage
Returns:
Iterator over all field names in the message.

isEmptyMsg

public final boolean isEmptyMsg()
Check if this is an empty message. An empty message is one that has not been defined externally via XML. These empty messages have their fields added dynamically by the application at run-time.

Specified by:
isEmptyMsg in interface RMapMessage
Returns:
true if this is an empty message. Otherwise returns false.
See Also:
setEmptyMsg(boolean)

setEmptyMsg

public final void setEmptyMsg(boolean emptyMsg)
Set the empty attribute of this message.

Parameters:
emptyMsg - true if this is an empty message. Otherwise false.
See Also:
isEmptyMsg()

supportNoCaseFldNames

public static final void supportNoCaseFldNames(boolean val)
Set the case-insensitive field name option.

Parameters:
val - If true then the framework allows field names to be accessed in a case-insensitive manner. Otherwise, field names are case sensitive.

setXmlTag

public static final void setXmlTag(java.lang.String newTag)
                            throws FieldValidationException
Register custom XML field tag.

Parameters:
newTag - New XML field tag.
Throws:
FieldValidationException

setXmlAttrNames

public static final void setXmlAttrNames(java.lang.String name)
                                  throws FieldValidationException
Register custom XML attribute names.

Parameters:
name - New name of the message name attribute.
Throws:
FieldValidationException

toPrettyPrintString

public java.lang.String toPrettyPrintString()
Get 'pretty print' string representation of message contents.

Returns:
Pretty print String representation of message contents.

toString

public java.lang.String toString()
Get string representation of message contents.

Returns:
String representation of message contents.

equals

public boolean equals(java.lang.Object anObject)
Check if another message is equal to this message. Equality is defined as both messages having the same fields (name, type), and all fields having the same, non-null, value.

Parameters:
anObject - Another message.
Returns:
true if another message is equal to this message. Otherwise, returns false.

equalsUsingTaggedFields

public boolean equalsUsingTaggedFields(java.lang.Object anObject,
                                       java.lang.String tag,
                                       boolean ignoreCase)
Check if another message is equal to this message. Equality is defined in the same way as for equals except for the following: only the fields with the specified tag are checked for equality.

Parameters:
anObject - Another message.
tag - Tag to look for.
ignoreCase - If true then tag search is case-insensitive.
Returns:
true if another message is equal to this message. Otherwise, returns false.
See Also:
equals(Object)

equalsDebug

public boolean equalsDebug(java.lang.Object anObject,
                           java.lang.StringBuffer sbResultText)
Check if another message is equal to this message. Equality is defined as both messages having the same number of fields, and all fields having the same, non-null, value. It returns(in sb) a formatted string of fields that fail the test

Parameters:
anObject - Another message.
sbResultText - - StringBuffer object to print non-matching fields
Returns:
true if another message is equal to this message. Otherwise, returns false.

equalIgnoreValuesDebug

public boolean equalIgnoreValuesDebug(java.lang.Object anObject,
                                      java.util.Vector ignoreFields)
Check if another message is equal to this message based on a subset of the fields in the messages. This is the debug version that prints the fields that do not match

Parameters:
anObject - Another message.
ignoreFields - Field to ignore when checking for equality.

equalIgnoreValues

public boolean equalIgnoreValues(java.lang.Object anObject,
                                 java.util.Vector ignoreFields)
Check if another message is equal to this message based on a subset of the fields in the messages.

Parameters:
anObject - Another message.
ignoreFields - Fields to ignore when checking for equality.

hashCode

public int hashCode()
Similar to the comments for hashcode in java.util.Hashtable Returns the hash code value for the Message. The hash code of the message is defined to be the sum of the hash code of each field value in the message. It is important that all the message field classes also implement equals and hashCode in a similar manner. The broad design of this method is taken from the book Effective Java (first edition) by Joshua Bloch

Returns:
Hash code value for this message.


Copyright © 2003-2006 CodeStreet. All Rights Reserved.