org.eclipse.net4j.util.registry
Class Registry<K,V>

java.lang.Object
  extended by org.eclipse.net4j.util.event.Notifier
      extended by org.eclipse.net4j.util.lifecycle.Lifecycle
          extended by org.eclipse.net4j.util.lifecycle.ShareableLifecycle
              extended by org.eclipse.net4j.util.container.Container<Map.Entry<K,V>>
                  extended by org.eclipse.net4j.util.registry.Registry<K,V>
All Implemented Interfaces:
Map<K,V>, IContainer<Map.Entry<K,V>>, INotifier, ILifecycle, ILifecycle.DeferrableActivation, IRegistry<K,V>
Direct Known Subclasses:
DelegatingRegistry, HashMapRegistry

public abstract class Registry<K,V>
extends Container<Map.Entry<K,V>>
implements IRegistry<K,V>


Nested Class Summary
protected  class Registry.Transaction
           
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Nested classes/interfaces inherited from interface org.eclipse.net4j.util.container.IContainer
IContainer.Modifiable<E>
 
Nested classes/interfaces inherited from interface org.eclipse.net4j.util.lifecycle.ILifecycle
ILifecycle.DeferrableActivation
 
Field Summary
 
Fields inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle
USE_LABEL
 
Constructor Summary
protected Registry()
           
protected Registry(boolean autoCommit)
           
 
Method Summary
protected  void autoCommit()
           
 void clear()
          Requires commit() to be called later if not isAutoCommit().
 void commit()
           
 void commit(boolean notifications)
           
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
           
protected  V deregister(Object key)
           
 Set<Map.Entry<K,V>> entrySet()
           
 V get(Object key)
           
 Map.Entry<K,V>[] getElements()
           
protected abstract  Map<K,V> getMap()
           
protected  Registry.Transaction getTransaction()
           
 boolean isAutoCommit()
           
 boolean isEmpty()
           
 Set<K> keySet()
           
 V put(K key, V value)
          Requires commit() to be called later if not isAutoCommit().
 void putAll(Map<? extends K,? extends V> t)
          Requires commit() to be called later if not isAutoCommit().
protected  V register(K key, V value)
           
 V remove(Object key)
          Requires commit() to be called later if not isAutoCommit().
 void setAutoCommit(boolean autoCommit)
           
 int size()
           
 String toString()
           
 Collection<V> values()
           
 
Methods inherited from class org.eclipse.net4j.util.container.Container
fireContainerEvent, fireContainerEvent, fireContainerEvent, fireElementAddedEvent, fireElementRemovedEvent, fireElementsAddedEvent, fireElementsRemovedEvent, fireEvent, newContainerEvent, newContainerEvent
 
Methods inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle
activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doActivate, doAfterActivate, doBeforeActivate, doBeforeDeactivate, doDeactivate, dump, getLifecycleState, isActive, isDeferredActivation
 
Methods inherited from class org.eclipse.net4j.util.event.Notifier
addListener, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListeners, lastListenerRemoved, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 
Methods inherited from interface org.eclipse.net4j.util.event.INotifier
addListener, getListeners, hasListeners, removeListener
 

Constructor Detail

Registry

protected Registry(boolean autoCommit)

Registry

protected Registry()
Method Detail

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map<K,V>
Specified by:
isEmpty in interface IContainer<Map.Entry<K,V>>
Overrides:
isEmpty in class Container<Map.Entry<K,V>>

size

public int size()
Specified by:
size in interface Map<K,V>

entrySet

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

keySet

public Set<K> keySet()
Specified by:
keySet in interface Map<K,V>

values

public Collection<V> values()
Specified by:
values in interface Map<K,V>

containsKey

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

containsValue

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

get

public V get(Object key)
Specified by:
get in interface Map<K,V>

put

public V put(K key,
             V value)
Requires commit() to be called later if not isAutoCommit().

Specified by:
put in interface Map<K,V>

putAll

public void putAll(Map<? extends K,? extends V> t)
Requires commit() to be called later if not isAutoCommit().

Specified by:
putAll in interface Map<K,V>

remove

public V remove(Object key)
Requires commit() to be called later if not isAutoCommit().

Specified by:
remove in interface Map<K,V>

clear

public void clear()
Requires commit() to be called later if not isAutoCommit().

Specified by:
clear in interface Map<K,V>

getElements

public Map.Entry<K,V>[] getElements()
Specified by:
getElements in interface IContainer<Map.Entry<K,V>>

isAutoCommit

public boolean isAutoCommit()
Specified by:
isAutoCommit in interface IRegistry<K,V>

setAutoCommit

public void setAutoCommit(boolean autoCommit)
Specified by:
setAutoCommit in interface IRegistry<K,V>

commit

public void commit(boolean notifications)
Specified by:
commit in interface IRegistry<K,V>

commit

public void commit()
Specified by:
commit in interface IRegistry<K,V>

toString

public String toString()
Overrides:
toString in class Lifecycle

register

protected V register(K key,
                     V value)

deregister

protected V deregister(Object key)

getTransaction

protected Registry.Transaction getTransaction()

autoCommit

protected void autoCommit()

getMap

protected abstract Map<K,V> getMap()


Copyright (c) 2011, 2012 Eike Stepper (Berlin, Germany) and others.