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:
java.lang.Cloneable, java.util.Map<java.lang.String,XAttribute>, XAttributeMap

public class XAttributeMapLazyImpl<T extends XAttributeMap>
extends java.lang.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
java.util.Map.Entry<K,V>
 
Constructor Summary
XAttributeMapLazyImpl(java.lang.Class<T> implementingClass)
          Creates a new lazy attribute map instance.
 
Method Summary
 void clear()
           
 java.lang.Object clone()
          Creates a clone, i.e.
 boolean containsKey(java.lang.Object key)
           
 boolean containsValue(java.lang.Object value)
           
 java.util.Set<java.util.Map.Entry<java.lang.String,XAttribute>> entrySet()
           
 XAttribute get(java.lang.Object key)
           
 java.lang.Class<T> getBackingStoreClass()
          Returns the class used for implementing the backing store.
 boolean isEmpty()
           
 java.util.Set<java.lang.String> keySet()
           
 XAttribute put(java.lang.String key, XAttribute value)
           
 void putAll(java.util.Map<? extends java.lang.String,? extends XAttribute> t)
           
 XAttribute remove(java.lang.Object key)
           
 int size()
           
 java.util.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(java.lang.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 java.lang.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 java.util.Map<java.lang.String,XAttribute>

containsKey

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

containsValue

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

entrySet

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

get

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

isEmpty

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

keySet

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

put

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

putAll

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

remove

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

size

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

values

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

clone

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

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