org.dasein.attributes
Class DataTypeMap

java.lang.Object
  extended by org.dasein.util.PseudoMap<String,DataType<? extends Object>>
      extended by org.dasein.attributes.DataTypeMap
All Implemented Interfaces:
Serializable, Map<String,DataType<? extends Object>>

public class DataTypeMap
extends PseudoMap<String,DataType<? extends Object>>
implements Serializable

Stores data types associated with an object. In general, most objects will have a class that defines their attribute types. These types are stored in a DataTypeMap for the defining class and the actual values are stored in an AttributeMap in the owning object.

This class was originally developed for the Simplicis Content Management System in 2003 and moved into an Open Source library in 2006.

Last modified: $Date: 2009/02/02 19:27:05 $

Version:
$Revision: 1.3 $
Author:
George Reese
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
DataTypeMap()
          Constructs a new data type map.
DataTypeMap(Map<String,? extends DataType<? extends Object>> map)
          Constructs a new data type map with type information from the provided mapping.
DataTypeMap(Map<String,? extends DataType<? extends Object>> map1, Map<String,? extends DataType<? extends Object>> map2)
          A constructor that essentially serves as a copying mechanism to allow you to add entries into a data type map.
 
Method Summary
 boolean containsKey(Object attr)
           
 boolean containsValue(Object val)
           
 Set<Map.Entry<String,DataType<? extends Object>>> entrySet()
           
 boolean equals(Object ob)
          Compares this data type map to another object and checks for equality.
 DataType<? extends Object> get(Object attr)
           
 int hashCode()
           
 boolean isEmpty()
           
 Set<String> keySet()
           
 int size()
           
 String toString()
           
 Collection<DataType<? extends Object>> values()
           
 
Methods inherited from class org.dasein.util.PseudoMap
clear, put, putAll, remove
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataTypeMap

public DataTypeMap()
Constructs a new data type map. Because instances of this class are immutable, there is no way to add contents to the map once it is created.


DataTypeMap

public DataTypeMap(Map<String,? extends DataType<? extends Object>> map)
Constructs a new data type map with type information from the provided mapping.

Parameters:
map - the mapping from which to copy type information.

DataTypeMap

public DataTypeMap(Map<String,? extends DataType<? extends Object>> map1,
                   Map<String,? extends DataType<? extends Object>> map2)
A constructor that essentially serves as a copying mechanism to allow you to add entries into a data type map. The first mapping is generally another data type map that contains the original entries and the second is any new values you wish to add. Values in the second mapping override any values of the same name in the first.

Parameters:
map1 - the original mapping of data types
map2 - new values to add onto or replace the originals
Method Detail

containsKey

public boolean containsKey(Object attr)
Specified by:
containsKey in interface Map<String,DataType<? extends Object>>
Parameters:
attr - the attribute being checked
Returns:
true if a type definition exists for the specified attribute

containsValue

public boolean containsValue(Object val)
Specified by:
containsValue in interface Map<String,DataType<? extends Object>>
Parameters:
val - the data type being checked
Returns:
true if the specified data type is stored in this mapping

entrySet

public Set<Map.Entry<String,DataType<? extends Object>>> entrySet()
Specified by:
entrySet in interface Map<String,DataType<? extends Object>>
Returns:
all entries in this data type map

equals

public boolean equals(Object ob)
Compares this data type map to another object and checks for equality.

Specified by:
equals in interface Map<String,DataType<? extends Object>>
Overrides:
equals in class Object
Parameters:
ob - the other object to check
Returns:
true if all members of both mappings are the same

get

public DataType<? extends Object> get(Object attr)
Specified by:
get in interface Map<String,DataType<? extends Object>>
Parameters:
attr - the attribute being sought
Returns:
the data type definition for the named attribute

hashCode

public int hashCode()
Specified by:
hashCode in interface Map<String,DataType<? extends Object>>
Overrides:
hashCode in class Object
Returns:
a unique hash code for the mapping

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map<String,DataType<? extends Object>>
Returns:
true if this mapping has no elements

keySet

public Set<String> keySet()
Specified by:
keySet in interface Map<String,DataType<? extends Object>>
Returns:
the attributes whose data type definitions are contained in this mapping

size

public int size()
Specified by:
size in interface Map<String,DataType<? extends Object>>
Returns:
the number of elements in this data type map

values

public Collection<DataType<? extends Object>> values()
Specified by:
values in interface Map<String,DataType<? extends Object>>
Returns:
all of the data types in this data type map

toString

public String toString()
Overrides:
toString in class Object
Returns:
a string representation of this data type map


Copyright © 2011 enStratus Networks LLC. All Rights Reserved.