org.deckfour.xes.model.impl
Class XAttributeMapLazyImpl<T extends XAttributeMap>

java.lang.Object
  extended by org.deckfour.xes.model.impl.XAttributeMapLazyImpl<T>
All Implemented Interfaces:
Cloneable, Map<String,XAttribute>, XAttributeMap

public class XAttributeMapLazyImpl<T extends XAttributeMap>
extends Object
implements XAttributeMap

Lazy implementation of the XAttributeMap interface. This implementation serves as a proxy for an XAttributeMapImpl instance, which is initially not present. Once the attribute map is to be filled with values, the true backing XAttributeMapImpl instance will be created on the fly, and used for storing and accessing data transparently. This lazy instantiation prevents lots of initializations of real attribute maps, since a large amount of attributes do not have any meta-attributes. This class is a generic, and can be parametrized with the actual implementation for the backing storage, which will then be instantiated on demand. Note that you will also have to pass the Class object of this implementation to the constructor, since this is required for instantiation (by Java).

Author:
Christian W. Guenther (christian@deckfour.org)

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
XAttributeMapLazyImpl(Class<T> implementingClass)
          Creates a new lazy attribute map instance.
 
Method Summary
 void clear()
           
 Object clone()
          Creates a clone, i.e.
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
           
 Set<Map.Entry<String,XAttribute>> entrySet()
           
 XAttribute get(Object key)
           
 Class<T> getBackingStoreClass()
          Returns the class used for implementing the backing store.
 boolean isEmpty()
           
 Set<String> keySet()
           
 XAttribute put(String key, XAttribute value)
           
 void putAll(Map<? extends String,? extends XAttribute> t)
           
 XAttribute remove(Object key)
           
 int size()
           
 Collection<XAttribute> values()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

XAttributeMapLazyImpl

public XAttributeMapLazyImpl(Class<T> implementingClass)
Creates a new lazy attribute map instance.

Parameters:
implementingClass - Class which should be used for instantiating the backing storage.
Method Detail

getBackingStoreClass

public Class<T> getBackingStoreClass()
Returns the class used for implementing the backing store.

Returns:
The class used for implementing the backing store.

clear

public void clear()
Specified by:
clear in interface Map<String,XAttribute>

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map<String,XAttribute>

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map<String,XAttribute>

entrySet

public Set<Map.Entry<String,XAttribute>> entrySet()
Specified by:
entrySet in interface Map<String,XAttribute>

get

public XAttribute get(Object key)
Specified by:
get in interface Map<String,XAttribute>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map<String,XAttribute>

keySet

public Set<String> keySet()
Specified by:
keySet in interface Map<String,XAttribute>

put

public XAttribute put(String key,
                      XAttribute value)
Specified by:
put in interface Map<String,XAttribute>

putAll

public void putAll(Map<? extends String,? extends XAttribute> t)
Specified by:
putAll in interface Map<String,XAttribute>

remove

public XAttribute remove(Object key)
Specified by:
remove in interface Map<String,XAttribute>

size

public int size()
Specified by:
size in interface Map<String,XAttribute>

values

public Collection<XAttribute> values()
Specified by:
values in interface Map<String,XAttribute>

clone

public Object clone()
Creates a clone, i.e. deep copy, of this lazy attribute map.

Specified by:
clone in interface XAttributeMap
Overrides:
clone in class Object
Returns:
An identical clone of the attribute map.