JBoss Managed Parent POM 2.1.1.SP2

org.jboss.metatype.api.values
Class MapCompositeValueSupport

java.lang.Object
  extended by org.jboss.metatype.api.values.AbstractMetaValue
      extended by org.jboss.metatype.api.values.MapCompositeValueSupport
All Implemented Interfaces:
Serializable, Cloneable, CompositeValue, MetaValue

public class MapCompositeValueSupport
extends AbstractMetaValue
implements CompositeValue

A CompositeValue representing a Map<String,MetaValue>, where the set of allowed keys is specified by the associated MapCompositeMetaType, and where all values must be of the same MetaType. To represent a Map<String,MetaValue> where values may have different MetaTypes, use CompositeValueSupport instead.

Version:
$Revision: 87521 $
Author:
Scott.Stark@jboss.org
See Also:
Serialized Form

Constructor Summary
MapCompositeValueSupport(Map<String,MetaValue> map, MetaType valueType)
           
MapCompositeValueSupport(MetaType valueType)
           
 
Method Summary
 boolean containsKey(String key)
          Tests whether a key is part of this composite value
 boolean containsValue(MetaValue value)
          Tests whether a item exists with the passed value
protected  Map<String,MetaValue> createMap()
          Create map instance.
 boolean equals(Object obj)
          Tests whether two composite value objects are equal
 MetaValue get(String key)
          Retrieve the value for the item with the passed key
 MetaValue[] getAll(String[] keys)
          Retrieve the array of values for the item with the passed keys
 MapCompositeMetaType getMetaType()
          Get the metatype for this value
 int hashCode()
          Generates a hashcode for the implementation.
 void put(String key, MetaValue value)
           
 MetaValue remove(String key)
           
 String toString()
          A string representation of the open mbean operation info.
 Collection<MetaValue> values()
          The values of this composite value
 
Methods inherited from class org.jboss.metatype.api.values.AbstractMetaValue
clone
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.metatype.api.values.MetaValue
clone
 

Constructor Detail

MapCompositeValueSupport

public MapCompositeValueSupport(MetaType valueType)

MapCompositeValueSupport

public MapCompositeValueSupport(Map<String,MetaValue> map,
                                MetaType valueType)
Method Detail

createMap

protected Map<String,MetaValue> createMap()
Create map instance. Default is hash map.

Returns:
the map

containsKey

public boolean containsKey(String key)
Description copied from interface: CompositeValue
Tests whether a key is part of this composite value

Specified by:
containsKey in interface CompositeValue
Parameters:
key - the key to test
Returns:
true when the key exists, false otherwise

containsValue

public boolean containsValue(MetaValue value)
Description copied from interface: CompositeValue
Tests whether a item exists with the passed value

Specified by:
containsValue in interface CompositeValue
Parameters:
value - the value to test
Returns:
true when the value exists, false otherwise

get

public MetaValue get(String key)
Description copied from interface: CompositeValue
Retrieve the value for the item with the passed key

Specified by:
get in interface CompositeValue
Parameters:
key - the key to the item
Returns:
the value

put

public void put(String key,
                MetaValue value)

remove

public MetaValue remove(String key)

getAll

public MetaValue[] getAll(String[] keys)
Description copied from interface: CompositeValue
Retrieve the array of values for the item with the passed keys

Specified by:
getAll in interface CompositeValue
Parameters:
keys - an array of key values
Returns:
the array of values

getMetaType

public MapCompositeMetaType getMetaType()
Description copied from interface: MetaValue
Get the metatype for this value

Specified by:
getMetaType in interface CompositeValue
Specified by:
getMetaType in interface MetaValue
Returns:
the metatype

values

public Collection<MetaValue> values()
Description copied from interface: CompositeValue
The values of this composite value

An iterator over the returned collection returns result in ascending lexicographic order

Specified by:
values in interface CompositeValue
Returns:
an unmodifiable Collection of the values of this CompositeMetaType.

equals

public boolean equals(Object obj)
Description copied from interface: CompositeValue
Tests whether two composite value objects are equal

The object is non-null
The object implements this interface
The composite meta types are equal
The values are equal

Specified by:
equals in interface CompositeValue
Overrides:
equals in class Object
Parameters:
obj - the object to test
Returns:
true when the above conditions are satisfied, false otherwise.

hashCode

public int hashCode()
Description copied from interface: CompositeValue
Generates a hashcode for the implementation.

The sum of the hashCodes for the elements mentioned in the equals method

Specified by:
hashCode in interface CompositeValue
Overrides:
hashCode in class Object
Returns:
the calculated hashcode

toString

public String toString()
Description copied from interface: CompositeValue
A string representation of the open mbean operation info.

It is made up of implementation class and the values mentioned in the equals method

Specified by:
toString in interface CompositeValue
Overrides:
toString in class Object
Returns:
the string

JBoss Managed Parent POM 2.1.1.SP2

Copyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.