com.codestreet.messageforge
Interface RMapMessage

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
RMsg

public interface RMapMessage
extends java.io.Serializable

Interface supported by all RMsg objects. This interface is patterned on the MapMessage interface found in the JMS messaging library.

Author:
Jawaid Hakim.

Method Summary
 void addField(RFld fld)
          Get a field to this message.
 int apply(RFunctor func)
          Apply a functor to all fields in the message.
 boolean apply(RFunctor func, java.lang.String name)
          Apply a functor to a named field in the message.
 boolean fieldExists(java.lang.String name)
          Check if a named field exists in this message.
 boolean getBoolean(java.lang.String name)
          Get the value of a boolean field.
 byte getByte(java.lang.String name)
          Get the value of a byte field.
 byte[] getBytes(java.lang.String name)
          Get the value of a opaque field.
 java.util.Date getDate(java.lang.String name)
          Get the value of a datetime field.
 double getDouble(java.lang.String name)
          Get the value of a double field.
 RFld getField(java.lang.String fldName)
          Get a named field from this message.
 RFld getFieldIfExists(java.lang.String fldName)
          Get a named field from this message.
 java.util.Iterator getFieldNames()
          Get names of all fields in this message.
 java.util.Iterator getFields()
          Get all fields in the message.
 RFld[] getFieldsAsArray()
          Get all fields in the message as an array.
 java.lang.Object getFieldValueAsObject(java.lang.String name)
          Get the value of a field.
 java.lang.String getFieldValueAsString(java.lang.String name)
          Get field value as string.
 float getFloat(java.lang.String name)
          Get the value of a float field.
 int getInt(java.lang.String name)
          Get the value of a integer field.
 long getLong(java.lang.String name)
          Get the value of a long field.
 java.lang.String getMemo(java.lang.String name)
          Get the value of a memos field.
 java.lang.String getName()
          Get the name of the message.
 byte[] getOpaque(java.lang.String name)
          Get the value of a Opaque field.
 short getShort(java.lang.String name)
          Get the value of a short field.
 java.lang.String getString(java.lang.String name)
          Get the value of a string field.
 java.lang.Object getTibrvMsg(java.lang.String name)
          Get the value of a RFldTibrvMsg field.
 boolean isConstrained(java.lang.String name)
          Determine if a named message field has constrains on it.
 boolean isEmptyMsg()
          Check if this is an empty message.
 boolean isLocked(java.lang.String name)
          Determine if a named message field is locked.
 boolean isValSet(java.lang.String name)
          Determine if the value of a named message field has been set.
 void setBoolean(java.lang.String name, boolean val)
          Get the value of a boolean field.
 void setBytes(java.lang.String name, byte[] val)
          Get the value of a opaque field.
 void setDate(java.lang.String name, java.util.Date val)
          Set the value of a datetime field.
 void setDate(java.lang.String name, long val)
          Set the value of a datetime field.
 void setDouble(java.lang.String name, double val)
          Set the value of a double field.
 void setFieldFromObject(java.lang.String name, java.lang.Object val)
          Set the value of a field from an object.
 void setFloat(java.lang.String name, float val)
          Set the value of a float field.
 void setInt(java.lang.String name, int val)
          Set the value of a integer field.
 void setLong(java.lang.String name, long val)
          Set the value of a long field.
 void setMemo(java.lang.String name, java.lang.String val)
          Get the value of a memo field.
 void setOpaque(java.lang.String name, byte[] val)
          Get the value of a opaque field.
 void setShort(java.lang.String name, short val)
          Set the value of a short field.
 void setString(java.lang.String name, java.lang.String val)
          Get the value of a string field.
 void setTibrvMsg(java.lang.String name, java.lang.Object val)
          Get the value of a RFldTibrvMsg field.
 

Method Detail

apply

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

Parameters:
func - Functor
Returns:
The number of fields to which the functor was applied.
Throws:
ProtocolException
FieldValidationException
See Also:
RFunctor

apply

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

Parameters:
func - Functor
Returns:
true if the named field was found and the functor was applied to it.
Throws:
ProtocolException
FieldValidationException
See Also:
RFunctor

getDate

public java.util.Date getDate(java.lang.String name)
                       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.

Parameters:
name - Field name.
Returns:
Date
Throws:
FieldValidationException

getName

public java.lang.String getName()
Get the name of the message.

Returns:
Message name.

getBoolean

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

Parameters:
name - Field name.
Returns:
Field value.
Throws:
FieldValidationException

getBytes

public byte[] getBytes(java.lang.String name)
                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.

Parameters:
name - Field name.
Returns:
Field value.
Throws:
FieldValidationException

getFloat

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

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

getDouble

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

Parameters:
name - Field name.
Returns:
Field value.
Throws:
FieldValidationException

getByte

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

Parameters:
name - Field name.
Returns:
Field value.
Throws:
FieldValidationException

getShort

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

Parameters:
name - Field name.
Returns:
Field value.
Throws:
FieldValidationException

getInt

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

Parameters:
name - Field name.
Returns:
Field value.
Throws:
FieldValidationException

getLong

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

Parameters:
name - Field name.
Returns:
Field value.
Throws:
FieldValidationException

getString

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

Parameters:
name - Field name.
Returns:
Field value.
Throws:
FieldValidationException

getMemo

public java.lang.String getMemo(java.lang.String name)
                         throws FieldValidationException
Get the value of a memos field.

Parameters:
name - Field name.
Returns:
Field value.
Throws:
FieldValidationException

getTibrvMsg

public java.lang.Object getTibrvMsg(java.lang.String name)
                             throws FieldValidationException
Get the value of a RFldTibrvMsg field.

Parameters:
name - Field name.
Returns:
Field value.
Throws:
FieldValidationException

getOpaque

public byte[] getOpaque(java.lang.String name)
                 throws FieldValidationException
Get the value of a Opaque field.

Parameters:
name - Field name.
Returns:
Field value.
Throws:
FieldValidationException

getFieldValueAsObject

public java.lang.Object getFieldValueAsObject(java.lang.String name)
                                       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:
name - Field name.
Returns:
Field value.
Throws:
FieldValidationException

getFieldValueAsString

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

Parameters:
name - Field name.
Returns:
Field value.
Throws:
FieldValidationException

setDate

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

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

setDate

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

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

setBoolean

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

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

setFloat

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

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

setDouble

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

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

setShort

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

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

setInt

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

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

setLong

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

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

setFieldFromObject

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

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

setString

public void setString(java.lang.String name,
                      java.lang.String val)
               throws FieldValidationException
Get the value of a string field.

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

setMemo

public void setMemo(java.lang.String name,
                    java.lang.String val)
             throws FieldValidationException
Get the value of a memo field.

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

setTibrvMsg

public void setTibrvMsg(java.lang.String name,
                        java.lang.Object val)
                 throws FieldValidationException
Get the value of a RFldTibrvMsg field.

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

setOpaque

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

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

setBytes

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

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

getFields

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

Returns:
Iterator over all RFld fields in the message.
See Also:
getFieldsAsArray()

getFieldsAsArray

public RFld[] getFieldsAsArray()
Get all fields in the message as an array.

Returns:
All fields in the message as an array.
See Also:
getFields()

getFieldIfExists

public RFld getFieldIfExists(java.lang.String fldName)
                      throws FieldValidationException
Get a named field from this message. Retuens null if the named field is not in the message.

Parameters:
fldName - Field name.
Returns:
Named field.
Throws:
FieldValidationException

getField

public 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.

Parameters:
fldName - Field name.
Returns:
Named field.
Throws:
FieldValidationException

addField

public void addField(RFld fld)
              throws FieldValidationException
Get a field to this message. Throws an exception if the named field is already in the message.

Parameters:
fld - Field.
Throws:
FieldValidationException

getFieldNames

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

Returns:
Iterator over ames of all fields in this message.

fieldExists

public boolean fieldExists(java.lang.String name)
Check if a named field exists in this message.

Parameters:
name - Field name.
Returns:
true if the named field exists. Otherwise returns false.

isEmptyMsg

public 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.

Returns:
true if this is an empty message. Otherwise returns false.

isValSet

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

Parameters:
name - Field name.
Returns:
true if the value of a named message field has been set. Otherwise, returns false.
Throws:
FieldValidationException

isLocked

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

Parameters:
name - Field name.
Returns:
true if the named field is locked. Otherwise, returns false.
Throws:
FieldValidationException

isConstrained

public boolean isConstrained(java.lang.String name)
                      throws FieldValidationException
Determine if a named message field has constrains on it.

Parameters:
name - Field name.
Returns:
true if the named field is constrained. Otherwise, returns false.
Throws:
FieldValidationException


Copyright © 2003-2006 CodeStreet. All Rights Reserved.