JBoss Managed Parent POM 2.1.1.SP2

org.jboss.metatype.api.values
Class CompositeValueSupport

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

public class CompositeValueSupport
extends AbstractMetaValue
implements CompositeValue

A CompositeValue representing a Map<String,MetaValue>, where the set of allowed keys and their corresponding values' MetaTypes are specified by the associated ImmutableCompositeMetaType or MutableCompositeMetaType. To represent a Map<String,MetaValue> where values must all have the same MetaType, use MapCompositeValueSupport instead.

Version:
$Revision: 1.1 $
Author:
Adrian Brock
See Also:
Serialized Form

Constructor Summary
CompositeValueSupport(CompositeMetaType metaType)
          Construct Composite Value
CompositeValueSupport(CompositeMetaType compositeMetaType, Map<String,MetaValue> items)
          Construct Composite Value
CompositeValueSupport(CompositeMetaType metaType, String[] itemNames, MetaValue[] itemValues)
          Construct Composite Value
 
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
 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
 CompositeMetaType getMetaType()
          Get the value's type - either a ImmutableCompositeMetaType or a MutableCompositeMetaType.
 int hashCode()
          Generates a hashcode for the implementation.
 void set(String key, MetaValue value)
          Set an item value
 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

CompositeValueSupport

public CompositeValueSupport(CompositeMetaType metaType,
                             String[] itemNames,
                             MetaValue[] itemValues)
Construct Composite Value

Parameters:
metaType - the composite meta type of the data
itemNames - the names of the values
itemValues - the values
Throws:
IllegalArgumentException - for a null metaType

CompositeValueSupport

public CompositeValueSupport(CompositeMetaType metaType)
Construct Composite Value

Parameters:
metaType - the composite meta type of the data
Throws:
IllegalArgumentException - for a null metaType

CompositeValueSupport

public CompositeValueSupport(CompositeMetaType compositeMetaType,
                             Map<String,MetaValue> items)
Construct Composite Value

Parameters:
compositeMetaType - the composite type of the data
items - map of strings to values
Throws:
IllegalArgumentException - for a null metaType
Method Detail

getMetaType

public CompositeMetaType getMetaType()
Get the value's type - either a ImmutableCompositeMetaType or a MutableCompositeMetaType.

Specified by:
getMetaType in interface CompositeValue
Specified by:
getMetaType in interface MetaValue
Returns:
the value's type - either a ImmutableCompositeMetaType or a MutableCompositeMetaType

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

set

public void set(String key,
                MetaValue value)
Set an item value

Parameters:
key - the key
value - the value

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

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

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.