Public Member Functions | Static Public Member Functions | Private Attributes

com::nmt::mgp::OptionHolder Class Reference

Container for message options. More...

List of all members.

Public Member Functions

 OptionHolder ()
 Public constructor.
void add (MgpOption option)
 Adds an MgpOption.
MgpOption getOption (int key)
 Gets the option specified by key.
String getValue (int key)
 Gets the value of the option specified by key.
void delete (MgpOption option)
 Deletes specified option.
void delete (int key)
 Deletes all options with a key that is equal to the specified key.
Vector getValues (int key)
 Gets all the values of the option specified by key, as a Vector of Strings.
int getIntValue (int key, int defaultValue)
 Gets the value of the option specified by key.
int getIntValue (int key) throws NumberFormatException
 Gets the value of the option specified by key.
void write (Writer out) throws IOException
 Writes all options to the supplied stream on the format specified by the Messaging Gateway Protocol (MGP).
Vector getOptions ()
 Returns a vector containing all options in sequential order.

Static Public Member Functions

static OptionHolder load (BufferedReader in) throws IOException
 Read all options from the supplied stream on the format specified by the Messaging Gateway Protocol (MGP).

Private Attributes

Vector options = new Vector()

Detailed Description

Container for message options.


Constructor & Destructor Documentation

com::nmt::mgp::OptionHolder::OptionHolder (  )  [inline]

Public constructor.

Referenced by load().


Member Function Documentation

void com::nmt::mgp::OptionHolder::add ( MgpOption  option  )  [inline]
void com::nmt::mgp::OptionHolder::delete ( MgpOption  option  )  [inline]

Deletes specified option.

References options.

Referenced by com::nmt::mgp::Message::deleteOption().

void com::nmt::mgp::OptionHolder::delete ( int  key  )  [inline]

Deletes all options with a key that is equal to the specified key.

References com::nmt::mgp::MgpOption::getKey(), and options.

int com::nmt::mgp::OptionHolder::getIntValue ( int  key  )  throws NumberFormatException [inline]

Gets the value of the option specified by key.

If there are multiple occurances the first one will be used.

Exceptions:
NumberFormatException if no option with the key exists.

References getValue().

int com::nmt::mgp::OptionHolder::getIntValue ( int  key,
int  defaultValue 
) [inline]

Gets the value of the option specified by key.

If no option with the key exists, the default value is returned.

Referenced by com::nmt::mgp::MgpSession::dbexec(), com::nmt::mgp::Message::getId(), and com::nmt::mgp::MgpSession::login().

MgpOption com::nmt::mgp::OptionHolder::getOption ( int  key  )  [inline]

Gets the option specified by key.

Returns:
the first matching option, or null if none is found

References com::nmt::mgp::MgpOption::getKey(), and options.

Vector com::nmt::mgp::OptionHolder::getOptions (  )  [inline]

Returns a vector containing all options in sequential order.

References options.

String com::nmt::mgp::OptionHolder::getValue ( int  key  )  [inline]

Gets the value of the option specified by key.

If there are multiple occurances the first one will be used.
If no option with the key exists, null is returned.

References com::nmt::mgp::MgpOption::getKey(), com::nmt::mgp::MgpOption::getValue(), and options.

Referenced by com::nmt::mgp::MgpSession::deleteMessage(), getIntValue(), com::nmt::mgp::MgpSession::login(), com::nmt::mgp::MgpSession::queryMessage(), com::nmt::mgp::MgpSession::readResponse(), and com::nmt::mgp::MgpSession::sendMessage().

Vector com::nmt::mgp::OptionHolder::getValues ( int  key  )  [inline]

Gets all the values of the option specified by key, as a Vector of Strings.

If no option with the key exists, an empty Vector is returned.

References com::nmt::mgp::MgpOption::getKey(), com::nmt::mgp::MgpOption::getValue(), and options.

Referenced by com::nmt::mgp::MgpSession::dbexec().

static OptionHolder com::nmt::mgp::OptionHolder::load ( BufferedReader  in  )  throws IOException [inline, static]

Read all options from the supplied stream on the format specified by the Messaging Gateway Protocol (MGP).

References add(), OptionHolder(), and options.

Referenced by com::nmt::mgp::Message::load(), and com::nmt::mgp::Message::Message().

void com::nmt::mgp::OptionHolder::write ( Writer  out  )  throws IOException [inline]

Writes all options to the supplied stream on the format specified by the Messaging Gateway Protocol (MGP).

References com::nmt::mgp::MgpOption::getKey(), com::nmt::mgp::MgpOption::getValue(), and options.

Referenced by com::nmt::mgp::Message::save().


Member Data Documentation

Vector com::nmt::mgp::OptionHolder::options = new Vector() [private]

The documentation for this class was generated from the following file: