public class WmRecord
extends java.lang.Object
implements javax.resource.cci.MappedRecord, com.wm.data.IData
WmRecord
is a J2EE-JCA 1.0-based MappedRecord
implementation that wraps the webMethods com.wm.data.IData
object.
Note that because javax.resource.cci.MappedRecord
requires each of
its keys to be unique, WmRecord
only allows unique key/value pairs.
However, IData
supports duplicate keys. To take advantage of this
capability, WmRecord
exposes methods that give adapter developers
access to the underlying IData
and IDataCursor
objects.
WmRecord
instances should not be created directly. The factory class
WmRecordFactory
should be used to create new
WmRecord
instances.
IData
,
IDataCursor
,
WmRecordFactory
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected com.wm.data.IData |
iData
The underlying IData object wrapped by this record.
|
protected com.wm.data.IDataCursor |
recordIDataCursor
A cursor to the underlying IData object wrapped by this record.
|
protected java.lang.String |
recordName
The name of the record.
|
protected java.lang.String |
shortDescription
A short description about this record.
|
Constructor and Description |
---|
WmRecord(java.lang.String recordName,
java.lang.String shortDescription,
com.wm.data.IData data)
Constructs a
WmRecord with the specified name,
description, and underlying IData. |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all key/value pairs in this record.
|
java.lang.Object |
clone()
Creates a new a copy of this record, with the same name and description,
and refering to the same IData object.
|
boolean |
containsKey(java.lang.Object key)
Returns true if this record contains the specified key.
|
boolean |
containsValue(java.lang.Object value)
Returns
true if this record contains the specified value. |
static WmRecord |
create() |
void |
destroy()
Destroy resources allocated for this Record.
|
java.util.Set |
entrySet()
Returns a set view of the key/value pairs contained in this record.
|
boolean |
equals(java.lang.Object obj)
Determines if an object is equal to this Record object.
|
void |
finalize()
Destroy resources allocated for this Record when this object is
destroyed by the JVM.
|
java.lang.Object |
get(java.lang.Object key)
Retrieves the value in this record using the specified string key.
|
java.math.BigDecimal |
getBigDecimal(java.lang.Object key)
Returns the
BigDecimal value associated with the specified key in this record. |
java.math.BigInteger |
getBigInteger(java.lang.Object key)
Returns the
BigInteger value associated with the specified key in this record. |
com.wm.data.IDataCursor |
getCursor()
Returns a cursor to the underlying
IData object of this WmRecord. |
double |
getDouble(java.lang.Object key)
Returns the
double value associated with the specified key in this record. |
float |
getFloat(java.lang.Object key)
Returns the
float value associated with the specified key in this record. |
com.wm.data.IData |
getIData()
Returns the underlying IData object wrapped by this record.
|
int |
getInt(java.lang.Object key)
Returns the
int value associated with the specified key in this record. |
long |
getLong(java.lang.Object key)
Returns the
long value associated with the specified key in this record. |
java.lang.String |
getRecordName()
Gets the name of this record.
|
java.lang.String |
getRecordShortDescription()
Gets this record's description.
|
com.wm.data.IDataSharedCursor |
getSharedCursor()
Get IDataSharedCursor of underlying IData object.
|
short |
getShort(java.lang.Object key)
Returns the
short value associated with the specified key in this record. |
boolean |
isEmpty()
Checks whether this record contains any field data.
|
java.util.Set |
keySet()
Returns a
Set view of the keys contained in this record. |
void |
put(java.lang.Object key,
double value)
Convenience method to add or update a field with a
double value. |
void |
put(java.lang.Object key,
float value)
Convenience method to add or update a field with a
float value. |
void |
put(java.lang.Object key,
int value)
Convenience method to add or update a field with a
int value. |
void |
put(java.lang.Object key,
long value)
Convenience method to add or update a field with a
long value. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Adds the specified key/value to this record if the key does not already exist, or
updates the value corresponding to the key if the key already exists in this record.
|
void |
put(java.lang.Object key,
short value)
Convenience method to add or update a field with a
short value. |
void |
putAll(java.util.Map recordImpl)
Copies all of the key/values from one WmRecord object to this record.
|
java.lang.Object |
remove(java.lang.Object key)
Removes the specified key and its corresponding value from this record.
|
void |
setIData(com.wm.data.IData iData)
Sets the underlying IData object wrapped by this record.
|
void |
setRecordName(java.lang.String name)
Sets the name of this record.
|
void |
setRecordShortDescription(java.lang.String description)
Sets this record's description.
|
int |
size()
Returns the number of key/value pairs in this record.
|
java.util.Collection |
values()
Returns a
Collection view of the values contained in this record. |
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected com.wm.data.IData iData
protected com.wm.data.IDataCursor recordIDataCursor
protected java.lang.String recordName
protected java.lang.String shortDescription
public WmRecord(java.lang.String recordName, java.lang.String shortDescription, com.wm.data.IData data)
WmRecord
with the specified name,
description, and underlying IData.recordName
- Name of this recordshortDescription
- A short description about this recorddata
- IData this record wraps.public void clear()
Note: Because this method must iterate through all of the elements in this record to fulfill its purpose, you should consider the potential overhead involved in such an operation, especially when dealing with large records.
clear
in interface java.util.Map
public java.lang.Object clone()
clone
in interface javax.resource.cci.Record
clone
in class java.lang.Object
public boolean containsKey(java.lang.Object key)
Note: the key object must be a String.
containsKey
in interface java.util.Map
key
- the key to search for in this record.java.lang.ClassCastException
- if key is not a String.public boolean containsValue(java.lang.Object value)
true
if this record contains the specified value.containsValue
in interface java.util.Map
value
- the value object to search for in this record.true
if the value object is in this record.public static WmRecord create()
public void destroy()
public java.util.Set entrySet()
RecordEntry
object,
which is an instance of Map.Entry
.
The returned Set
supports element removal using the
Iterator.remove
, Set.remove
and Set.clear
operations. These methods will remove both the key and the value from the record.
The returned Set
does not support any add or update operations.
entrySet
in interface java.util.Map
RecordEntrySet
.RecordEntrySet
,
RecordEntry
,
Set
,
Map.Entry
public boolean equals(java.lang.Object obj)
equals
in interface java.util.Map
equals
in interface javax.resource.cci.Record
equals
in class java.lang.Object
obj
- Record object to check.public void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
- Throws an exception.public java.lang.Object get(java.lang.Object key)
Note: If an adapter writer uses the IData
methods to add key/values
into this record, it is possible for this record to have more than one key/value
pair with the same key name. In this case, this method returns the first value in
the record with the same key.
get
in interface java.util.Map
key
- the record entry's key. The key must be a String
object.IData
object, but not a WmRecord
,
this method will wrap the IData
in a WmRecord
object.java.lang.ClassCastException
- if key is not a String
.public java.math.BigDecimal getBigDecimal(java.lang.Object key) throws java.lang.NumberFormatException, AdapterException
BigDecimal
value associated with the specified key in this record.
This method retrieves the object associated with the specified key in this record.
If the value object is a BigDecimal
type, this method returns the
BigDecimal
value. If the value object is a String
type, this method
attempts to parse the String
and convert it to a BigDecimal
Note: If an adapter writer uses the IData methods to add key/values into this record,
it is possible for this record to have more than one key/value pair with the same key name.
If this is the case, this method obtains the first value object in the record with the
specified key and attempts to convert that value to a BigDecimal
.
key
- The record entry's key. The key must be a String object.BigDecimal
value, if the value exists and is a valid
BigDecimal
.AdapterException
- if the key does not exist in this record,
or if the value object returned is not a BigDecimal
or String
.java.lang.NumberFormatException
- if the value object is a String, but cannot be parsed into a
BigDecimal
.public java.math.BigInteger getBigInteger(java.lang.Object key) throws java.lang.NumberFormatException, AdapterException
BigInteger
value associated with the specified key in this record.
This method retrieves the object associated with the specified key in this record. If the
value object is a BigInteger
type, this method returns the BigInteger
value. If the value object is a String
type, this method attempts to parse the
String
and convert it to a BigInteger
Note: If an adapter writer uses the IData methods to add key/values into this record,
it is possible for this record to have more than one key/value pair with the same key name.
If this is the case, this method obtains the first value object in the record with the
specified key and attempts to convert that value to an BigInteger
.
key
- The record entry's key. The key must be a String object.BigInteger
value, if the value exists and is a valid
BigInteger
.AdapterException
- if the key does not exist in this record,
or if the value object returned is not a BigInteger
or String
.java.lang.NumberFormatException
- if the value object is a String, but cannot be parsed into a
BigInteger
.public com.wm.data.IDataCursor getCursor()
IData
object of this WmRecord.getCursor
in interface com.wm.data.IData
public double getDouble(java.lang.Object key) throws java.lang.NumberFormatException, AdapterException
double
value associated with the specified key in this record.
This method retrieves the object associated with the specified key in this record.
If the value object is a Number
type, this method returns the
double
value. If the value object is a String
type, this
method attempts to parse the String
and convert it to a double
Note: If an adapter writer uses the IData methods to add key/values into this record,
it is possible for this record to have more than one key/value pair with the same key name.
If this is the case, this method obtains the first value object in the record with the
specified key and attempts to convert that value to a double
.
key
- The record entry's key. The key must be a String object.double
value, if the value exists and is a valid double
.AdapterException
- if the key does not exist in this record,
or if the value object returned is not a Number
or String
.java.lang.NumberFormatException
- if the value object is a String, but cannot be parsed into
an double
.public float getFloat(java.lang.Object key) throws java.lang.NumberFormatException, AdapterException
float
value associated with the specified key in this record.
This method retrieves the object associated with the specified key in this record.
If the value object is a Number
type, this method returns the
float
value. If the value object is a String
type, this
method attempts to parse the String
and convert it to a float
Note: If an adapter writer uses the IData methods to add key/values into this record,
it is possible for this record to have more than one key/value pair with the same key name.
If this is the case, this method obtains the first value object in the record with the
specified key and attempts to convert that value to a float
.
key
- The record entry's key. The key must be a String object.float
value, if the value exists and is a valid float
.AdapterException
- if the key does not exist in this record,
or if the value object returned is not a Number
or String
.java.lang.NumberFormatException
- if the value object is a String, but cannot be parsed into
a float
.public com.wm.data.IData getIData()
public int getInt(java.lang.Object key) throws java.lang.NumberFormatException, AdapterException
int
value associated with the specified key in this record.
This method retrieves the object associated with the specified key in this record.
If the value object is a Number
type, this method returns the
int
value. If the value object is a String
type, this
method attempts to parse the String
and convert it to an int
Note: If an adapter writer uses the IData methods to add key/values into this record,
it is possible for this record to have more than one key/value pair with the same key name.
If this is the case, this method obtains the first value object in the record with the
specified key and attempts to convert that value to a int
.
key
- The record entry's key. The key must be a String object.int
value, if the value exists and is a valid int
.AdapterException
- if the key does not exist in this record,
or if the value object returned is not a Number
or String
.java.lang.NumberFormatException
- if the value object is a String, but cannot be parsed into
a int
.public long getLong(java.lang.Object key) throws java.lang.NumberFormatException, AdapterException
long
value associated with the specified key in this record.
This method retrieves the object associated with the specified key in this record.
If the value object is a Number
type, this method returns the long
value. If the value object is a String
type, this method attempts to parse the
String
and convert it to a long
Note: If an adapter writer uses the IData methods to add key/values into this record,
it is possible for this record to have more than one key/value pair with the same key name.
If this is the case, this method obtains the first value object in the record with the
specified key and attempts to convert that value to a long
.
key
- The record entry's key. The key must be a String object.long
value, if the value exists and is a valid long
.AdapterException
- if the key does not exist in this record,
or if the value object returned is not a Number
or String
.java.lang.NumberFormatException
- if the value object is a String, but cannot be parsed into
a long
.public java.lang.String getRecordName()
getRecordName
in interface javax.resource.cci.Record
public java.lang.String getRecordShortDescription()
getRecordShortDescription
in interface javax.resource.cci.Record
public com.wm.data.IDataSharedCursor getSharedCursor()
getSharedCursor
in interface com.wm.data.IData
public short getShort(java.lang.Object key) throws java.lang.NumberFormatException, AdapterException
short
value associated with the specified key in this record.
This method retrieves the object associated with the specified key in this record.
If the value object is a Number
type, this method returns the short
value. If the value object is a String
type, this method attempts to parse the
String
and convert it to a short
Note: If an adapter writer uses the IData methods to add key/values into this record,
it is possible for this record to have more than one key/value pair with the same key name.
If this is the case, this method obtains the first value object in the record with the
specified key and attempts to convert that value to a short
.
key
- The record entry's key. The key must be a String object.short
value, if the value exists and is a valid short
.AdapterException
- if the key does not exist in this record,
or if the value object returned is not a Number
or String
.java.lang.NumberFormatException
- if the value object is a String, but cannot be parsed into
a short
.public boolean isEmpty()
isEmpty
in interface java.util.Map
public java.util.Set keySet()
Set
view of the keys contained in this record.
The returned Set
supports element removal, via the
Iterator.remove
, Set.remove
and Set.clear
operations. These methods will remove both the key and the value from this record.
The returned Set
does not support any add or update operations.
keySet
in interface java.util.Map
IDataKeySet
.IDataKeySet
,
Set
public void put(java.lang.Object key, double value)
double
value.
The double
value is converted into a Double
object before
being adding to this record.
If the key does not already exist in this record, the key/Double
value
is added to this record. If the key already exists in this record, the corresponding
value is updated.
Note: If an adapter writer uses the IData methods to add key/values into this record, it is possible for this record to have more than one key/value pair with the same key name. If this method is used to update a key that contains more than one value, this method will update the first value with the specified key.
key
- String key with which the specified value is to be associated.value
- double
value to be associated with the specified key.public void put(java.lang.Object key, float value)
float
value.
The float
value is converted into a Float
object before
it is added to this record.
If the key does not already exist in this record, the key/Float
value is added to this record. If the key already exists in this record, the
corresponding value is updated.
Note: If an adapter writer uses the IData methods to add key/values into this record, it is possible for this record to have more than one key/value pair with the same key name. If this method is used to update a key that contains more than one value, this method will update the first value with the specified key.
key
- String key with which the specified value is to be associated.value
- float
value to be associated with the specified key.public void put(java.lang.Object key, int value)
int
value.
The int
value is converted into an Integer
object
before adding to this record.
If the key does not already exist in this record, the key/Integer
value is added this record. If the key already exists in this record, the
corresponding value is updated.
Note: If an adapter writer uses the IData methods to add key/values into this record, it is possible for this record to have more than one key/value pair with the same key name. If this method is used to update a key that contains more than one value, this method will update the first value with the specified key.
key
- String key with which the specified value is to be associated.value
- int
value to be associated with the specified key.public void put(java.lang.Object key, long value)
long
value.
The long
value is converted into a Long
object before it is
added to this record.
If the key does not already exist in this record, the key/Long
value
is added to this record. If the key already exists in this record, the corresponding
value is updated.
Note: If an adapter writer uses the IData methods to add key/values into this record, it is possible for this record to have more than one key/value pair with the same key name. If this method is used to update a key that contains more than one value, this method will update the first value with the specified key.
key
- String key with which the specified value is to be associated.value
- long
value to be associated with the specified key.public java.lang.Object put(java.lang.Object key, java.lang.Object value)
Note: If an adapter writer uses the IData methods to add key/values into this record, it is possible for this record to have more than one key/value pair with the same key name. If this method is used to update a key that contains more than one value, this method will update the first value with the specified key.
put
in interface java.util.Map
key
- String key with which the specified value is to be associated.value
- value to be associated with the specified key.null
.
If the previous value object is an IData object but not a WmRecord, this method
will wrap the IData in a WmRecord object and return the WmRecord object.java.lang.ClassCastException
- if the key is not a String.public void put(java.lang.Object key, short value)
short
value.
The short
value is converted into a Short
object before
it is added to this record.
If the key does not already exist in this record, the key/Short
value is added to this record. If the key already exists in this record, the
corresponding value is updated.
Note: If an adapter writer uses the IData methods to add key/values into this record, it is possible for this record to have more than one key/value pair with the same key name. If this method is used to update a key that contains more than one value, this method will update the first value with the specified key.
key
- String key with which the specified value is to be associated.value
- short
value to be associated with the specified key.public void putAll(java.util.Map recordImpl)
putAll
in interface java.util.Map
recordImpl
- WmRecord object to copy from.java.lang.ClassCastException
- if input is not a WmRecord object.public java.lang.Object remove(java.lang.Object key)
String
object.
Note: If this record contains multiple entries with same key name (because
the adapter writer used the IData
API methods to add key/value pairs
with the same key name), this method removes the first matching key/value pair.
remove
in interface java.util.Map
key
- the key string of the record to be removed.null
return value indicates either that the key does not exist in this record
or that a key with a corresponding value of null
was removed.java.lang.ClassCastException
- if the key is not a String.public void setIData(com.wm.data.IData iData)
iData
- the IData object this record wraps.public void setRecordName(java.lang.String name)
setRecordName
in interface javax.resource.cci.Record
name
- Name of this record.public void setRecordShortDescription(java.lang.String description)
setRecordShortDescription
in interface javax.resource.cci.Record
description
- short description of this recordpublic int size()
Note: Because this method must iterate through all of the elements in this record to fulfill its purpose, you should consider the potential overhead involved in such an operation, especially when dealing with large records.
size
in interface java.util.Map
public java.util.Collection values()
Collection
view of the values contained in this record.
The returned Collection
supports element removal using the
Iterator.remove
, Collection.remove
and
Collection.clear
operations. These methods will remove both the key
and the value from this record.
The returned Collection
does not support any add or update operations.
values
in interface java.util.Map
IDataValueCollection
.IDataValueCollection
,
Collection
Copyright © 2003 - 2021 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.