GNU Classpath (0.95) | |
Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
javax.management.openmbean.TabularDataSupport
public class TabularDataSupport
extends Object
implements TabularData, Serializable, Cloneable, Map<K,V>
TabularData
interface using a HashMap
.
Constructor Summary | |
| |
|
Method Summary | |
Object[] |
|
void |
|
Object |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
Set |
|
boolean | |
Object | |
CompositeData |
|
TabularType |
|
int |
|
boolean |
|
Set |
|
Object |
|
void |
|
void |
|
void |
|
Object | |
CompositeData |
|
int |
|
String |
|
Collection |
|
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
Constructor Details
TabularDataSupport
public TabularDataSupport(TabularType type)
Constructs a new empty TabularDataSupport
with the
specified type. The type may not be null. This constructor
simply calls the other, with the default initial capacity of
101
and default load factor of 0.75
.
- Parameters:
type
- the tabular type of this tabular data instance.
- Throws:
IllegalArgumentException
- if type
is
null
.
TabularDataSupport
public TabularDataSupport(TabularType type,
int cap,
float lf)
Constructs a new empty TabularDataSupport
with the
specified type and the supplied initial capacity and load factor
being used for the underlying HashMap
. The
type may not be null and the initial capacity and load factor
must be positive.
- Parameters:
type
- the tabular type of this tabular data instance.cap
- the initial capacity of the underlying map.lf
- the load factor of the underlying map.
- Throws:
IllegalArgumentException
- if type
is
null
, or
cap
or
lf
are
negative.
Method Details
calculateIndex
public Object[] calculateIndex(CompositeData val)
Calculates the index the specified CompositeData
value
would have, if it was to be added to this TabularData
instance. This method includes a check that the type of the
given value is the same as the row type of this instance, but not
a check for existing instances of the given value. The value
must also not be null
. Possible indices are
selected by the TabularType.getIndexNames()
method of
this instance's tabular type. The returned indices are the
values of the fields in the supplied CompositeData
instance that match the names given in the TabularType
.
- Specified by:
- calculateIndex in interface TabularData
- Parameters:
val
- the CompositeData
value whose index should
be calculated.
- Returns:
- the index the value would take on, if it were to be added.
- Throws:
NullPointerException
- if the value is null
.InvalidOpenTypeException
- if the value does not match the
row type of this instance.
clear
public void clear()
Removes all CompositeData
values from the table.
- Specified by:
- clear in interface TabularData
- clear in interface Map<K,V>
clone
public Object clone()
Returns a shallow clone of the information, as obtained by the
Object
implementation of Object.clone()
. The map
is also cloned, but it still references the same objects.
- Returns:
- a shallow clone of this
TabularDataSupport
.
containsKey
public boolean containsKey(Object key)
Returns true iff this instance of the TabularData
class
contains a CompositeData
value at the specified index.
The method returns false
if the given key can
not be cast to an Object
array; otherwise
it returns the result of containsKey(Object[])
.
- Specified by:
- containsKey in interface Map<K,V>
- Parameters:
key
- the key to test for.
- Returns:
- true if the key maps to a
CompositeData
value.
containsKey
public boolean containsKey(Object[] key)
Returns true iff this instance of the TabularData
class
contains a CompositeData
value at the specified index.
In any other circumstance, including if the given key
is null
or of the incorrect type, according to
the TabularType
of this instance, this method returns
false.
- Specified by:
- containsKey in interface TabularData
- Parameters:
key
- the key to test for.
- Returns:
- true if the key maps to a
CompositeData
value.
containsValue
public boolean containsValue(Object val)
Returns true iff this instance of the TabularData
class
contains the specified CompositeData
value. If the given
value is not an instance of CompositeData
, this method
simply returns false.
- Specified by:
- containsValue in interface Map<K,V>
- Parameters:
val
- the value to test for.
- Returns:
- true if the value exists.
containsValue
public boolean containsValue(CompositeData val)
Returns true iff this instance of the TabularData
class
contains the specified CompositeData
value.
In any other circumstance, including if the given value
is null
or of the incorrect type, according to
the TabularType
of this instance, this method returns
false.
- Specified by:
- containsValue in interface TabularData
- Parameters:
val
- the value to test for.
- Returns:
- true if the value exists.
entrySet
public Set> entrySet()
Returns a set view of the mappings in this Map. Each element in the
set is a Map.Entry. The set is backed by the map, so that changes in
one show up in the other. Modifications made while an iterator is
in progress cause undefined behavior. If the set supports removal,
these methods remove the underlying mapping from the map:
Iterator.remove
, Set.remove
,
removeAll
, retainAll
, and clear
.
Element addition, via add
or addAll
, is
not supported via this set.
Note: using the
java.util.Map.Entry#setValue(Object) will cause corruption of
the index to row mappings.
@return the set view of all mapping entries
@see java.util.Map.Entry
equals
public boolean equals(Object obj)
Compares the specified object with this object for equality.
The object is judged equivalent if it is non-null, and also
an instance of TabularData
with the same row type,
and CompositeData
values. The two compared instances may
be equivalent even if they represent different implementations
of TabularData
.
- Specified by:
- equals in interface TabularData
- equals in interface Map<K,V>
- Parameters:
obj
- the object to compare for equality.
- Returns:
- true if
obj
is equal to this
.
get
public Object get(Object key)
Retrieves the value for the specified key by simply
calling get((Object[]) key)
.
- Parameters:
key
- the key whose value should be returned.
- Returns:
- the matching
CompositeData
value, or
null
if one does not exist.
- Throws:
NullPointerException
- if the key is null
.ClassCastException
- if the key is not an instance
of Object[]
.InvalidKeyException
- if the key does not match
the TabularType
of this
instance.
get
public CompositeData get(Object[] key)
Retrieves the CompositeData
value for the specified
key, or null
if no such mapping exists.
- Specified by:
- get in interface TabularData
- Parameters:
key
- the key whose value should be returned.
- Returns:
- the matching
CompositeData
value, or
null
if one does not exist.
- Throws:
NullPointerException
- if the key is null
.InvalidKeyException
- if the key does not match
the TabularType
of this
instance.
getTabularType
public TabularType getTabularType()
Returns the tabular type which corresponds to this instance
of TabularData
.
- Specified by:
- getTabularType in interface TabularData
- Returns:
- the tabular type for this instance.
hashCode
public int hashCode()
Returns the hash code of the composite data type. This is
computed as the sum of the hash codes of each value, together
with the hash code of the tabular type. These are the same
elements of the type that are compared as part of the equals(Object)
method, thus ensuring that the
hashcode is compatible with the equality test.
- Specified by:
- hashCode in interface TabularData
- hashCode in interface Map<K,V>
- Returns:
- the hash code of this instance.
isEmpty
public boolean isEmpty()
Returns true if this TabularData
instance
contains no CompositeData
values.
- Specified by:
- isEmpty in interface TabularData
- isEmpty in interface Map<K,V>
- Returns:
- true if the instance is devoid of rows.
keySet
public Set