com.bankframe.bo
Class DataPacket

java.lang.Object
  extended bycom.bankframe.bo.DataPacket
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
StructuredDataPacket

public class DataPacket
extends java.lang.Object
implements java.io.Serializable

The DataPacket class. This class is used to store data. Each element in the DataPacket is held and located through a string key. The DataPacket can hold any object instance.

Author:
ETU
See Also:
Serialized Form

Field Summary
static java.lang.String DATA_PACKET_NAME
          An ease-of-use constant for specifing the DataPacket's string name.
static java.lang.String OWNER
          An ease-of-use constant for specifing the DataPacket's owner.
static java.lang.String REQUEST_ID
          An ease-of-use constant for specifing the DataPacket's request_id.
 
Constructor Summary
DataPacket()
          The default class constructor.
DataPacket(java.lang.String name)
          The class constructor.
 
Method Summary
static DataPacket append(DataPacket data, DataPacket dataToAppend)
          This method adds a datapacket's contents to another datapacket.
 void clear()
          This method clears this datapacket so that it contains no keys.
 boolean contains(java.lang.Object value)
          This method tests if some key maps into the specified value in the datapacket.
 boolean containsKey(java.lang.Object key)
          This method tests if the specified object is a key in this datapacket.
 java.util.Enumeration elements()
          This method returns an enumeration of the values in this datapacket.
 boolean equals(java.lang.Object o)
          This method tests if the DataPacket is equal to another DataPacket
 java.lang.Object get(java.lang.Object key)
          This method returns the value to which the specified key is mapped in this datapacket.
 java.lang.String getName()
          This method returns the string name of the data packet.
 java.lang.String getString(java.lang.Object key)
          This method returns the value to which the specified key is mapped in this datapacket.
 int hashCode()
          This method calculates the hash-code for the DataPacket
 boolean isEmpty()
          This method tests if this datapacket maps no keys to values.
 java.util.Enumeration keys()
          This method returns an enumeration of the keys in this datapacket.
 java.lang.Object put(java.lang.String key, java.lang.Object value)
          This method provides a put that requires data keys to be strings.
 java.lang.Object remove(java.lang.Object key)
          This method removes the key and its corresponding value from this datapacket.
 void setName(java.lang.String name)
          This method sets the name of the data packet.
 int size()
          This method returns the number of keys in this datapacket.
 java.util.Vector toList(boolean print)
          This method returns the contents of this instance of the DataPacket class in a vector, where each element in the vector is a string in the format: 'key=value'.
 void toListInOrder(java.lang.String[] order)
          This method prints the contents of this instance to the system console.
 java.lang.String toString()
          Represents the object as a string.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DATA_PACKET_NAME

public static final java.lang.String DATA_PACKET_NAME
An ease-of-use constant for specifing the DataPacket's string name.

See Also:
Constant Field Values

REQUEST_ID

public static final java.lang.String REQUEST_ID
An ease-of-use constant for specifing the DataPacket's request_id.

See Also:
Constant Field Values

OWNER

public static final java.lang.String OWNER
An ease-of-use constant for specifing the DataPacket's owner.

See Also:
Constant Field Values
Constructor Detail

DataPacket

public DataPacket()
The default class constructor. If you use this constructor, the value of this instance's DATA_PACKET_NAME is set to 'NO PACKET NAME'.


DataPacket

public DataPacket(java.lang.String name)
The class constructor.

Parameters:
name - the string name of this instance.
Method Detail

equals

public boolean equals(java.lang.Object o)
This method tests if the DataPacket is equal to another DataPacket

Parameters:
o - is the other DataPacket to compare
Returns:
true if the DataPackets are equal

hashCode

public int hashCode()
This method calculates the hash-code for the DataPacket

Returns:
hash code value for the DataPacket

append

public static DataPacket append(DataPacket data,
                                DataPacket dataToAppend)
This method adds a datapacket's contents to another datapacket. If the data to be addded as an existing key in the datapacket being appeneded then the data is ignored.

Parameters:
data - com.bankframe.bo.DataPacket
dataToAppend - com.bankframe.bo.DataPacket
Returns:
com.bankframe.bo.DataPacket containing the contents of both input DataPackets

clear

public void clear()
This method clears this datapacket so that it contains no keys.


contains

public boolean contains(java.lang.Object value)
This method tests if some key maps into the specified value in the datapacket.

Parameters:
value - java.lang.Object the value to search for in the datapacket
Returns:
true if some key maps to the value argument in this datapacket, false otherwise.

containsKey

public boolean containsKey(java.lang.Object key)
This method tests if the specified object is a key in this datapacket.

Parameters:
key - java.lang.Object the key to search for in the datapacket
Returns:
true if the specified object is a key in this datapacket; false otherwise.

elements

public java.util.Enumeration elements()
This method returns an enumeration of the values in this datapacket.

Returns:
an enumeration of the values in this datapacket.

get

public java.lang.Object get(java.lang.Object key)
This method returns the value to which the specified key is mapped in this datapacket.

Parameters:
key - java.lang.Object the key to retrieve from the datapacket
Returns:
the value to which the key is mapped in this datapacket; null if the key is not mapped to any value in this datapacket.

getName

public java.lang.String getName()
This method returns the string name of the data packet.

Returns:
the string name of this DataPacket.

getString

public java.lang.String getString(java.lang.Object key)
This method returns the value to which the specified key is mapped in this datapacket.

Parameters:
key - java.lang.String
Returns:
the value to which the key is mapped in this datapacket as a String; null if the key is not mapped to any value in this datapacket.

isEmpty

public boolean isEmpty()
This method tests if this datapacket maps no keys to values.

Returns:
true if this datapacket maps no keys to values; false otherwise.

keys

public java.util.Enumeration keys()
This method returns an enumeration of the keys in this datapacket.

Returns:
an enumeration of the keys in this datapacket.

put

public java.lang.Object put(java.lang.String key,
                            java.lang.Object value)
This method provides a put that requires data keys to be strings. Maps the specified key to the specified value in this hashtable. Neither the key nor the value can be null. The value can be retrieved by calling the get method with a key that is equal to the original key.

Parameters:
key - the string key.
value - the object to be stored.
Returns:
the previous value of the specified key in this hashtable, or null if it did not have one.

remove

public java.lang.Object remove(java.lang.Object key)
This method removes the key and its corresponding value from this datapacket. This method does nothing if the key is not in the hashtable.

Parameters:
key - the key that needs to be removed.
Returns:
the value to whihc the key had been mapped in this datapacket, or null if the key did not have a mapping.

setName

public void setName(java.lang.String name)
This method sets the name of the data packet.

Parameters:
name - the string name of this instance.

size

public int size()
This method returns the number of keys in this datapacket.

Returns:
the number of keys in this datapacket.

toList

public java.util.Vector toList(boolean print)
This method returns the contents of this instance of the DataPacket class in a vector, where each element in the vector is a string in the format: 'key=value'. This method can also dump the contents of this instance to the system out console if the print parameter is true.

Parameters:
print - the contents of this instance to the system out console.
Returns:
the contents of this instance in as a vector object.

toListInOrder

public void toListInOrder(java.lang.String[] order)
This method prints the contents of this instance to the system console. The contents can be printed in order, by suppling a string array of the order required. For example an order array { "Loan", "Current" } will print all the key values beginning with 'Loan' first, followed by all the key values starting with 'Current'.

Parameters:
order - the string array order for printing this instance's contents.

toString

public java.lang.String toString()
Represents the object as a string.



Copyright © 2004 Siebel Systems, Inc. All rights reserved.