org.jboss.webbeans.contexts
Class AbstractBeanMapAdaptor

java.lang.Object
  extended by org.jboss.webbeans.contexts.AbstractBeanMapAdaptor
All Implemented Interfaces:
BeanMap
Direct Known Subclasses:
ApplicationBeanMap, SessionBeanMap

public abstract class AbstractBeanMapAdaptor
extends java.lang.Object
implements BeanMap


Constructor Summary
AbstractBeanMapAdaptor()
           
 
Method Summary
 void clear()
          Clears the bean map
<T> T
get(Contextual<? extends T> bean)
          Gets a bean from the map
protected abstract  java.lang.Object getAttribute(java.lang.String key)
          Gets an attribute from the underlying storage
protected abstract  java.util.Enumeration<java.lang.String> getAttributeNames()
          Gets an enumeration of the beans present in the underlying storage
protected  java.lang.String getBeanKey(Contextual<?> bean)
          Returns a map key to a bean.
protected abstract  java.lang.String getKeyPrefix()
          Gets a key prefix that should be prefixed to names
 java.lang.Iterable<Contextual<? extends java.lang.Object>> keySet()
          Returns the beans present in the map
<T> void
put(Contextual<? extends T> bean, T instance)
          Puts an instance of a bean in the map
<T> T
remove(Contextual<? extends T> bean)
          Removes an instance from the map
protected abstract  void removeAttribute(java.lang.String key)
          Removes an attribute from the underlying storage
protected abstract  void setAttribute(java.lang.String key, java.lang.Object instance)
          Sets an instance under a key in the underlying storage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractBeanMapAdaptor

public AbstractBeanMapAdaptor()
Method Detail

get

public <T> T get(Contextual<? extends T> bean)
Gets a bean from the map

Specified by:
get in interface BeanMap
Parameters:
bean - The bean to get
Returns:
The instance

remove

public <T> T remove(Contextual<? extends T> bean)
Removes an instance from the map

Specified by:
remove in interface BeanMap
Parameters:
bean - The bean of the instance to remove
Returns:
The removed instance

clear

public void clear()
Clears the bean map

Specified by:
clear in interface BeanMap

keySet

public java.lang.Iterable<Contextual<? extends java.lang.Object>> keySet()
Returns the beans present in the map

Specified by:
keySet in interface BeanMap
Returns:
The beans

put

public <T> void put(Contextual<? extends T> bean,
                    T instance)
Puts an instance of a bean in the map

Specified by:
put in interface BeanMap
Parameters:
bean - The key bean
instance - The instance

getAttribute

protected abstract java.lang.Object getAttribute(java.lang.String key)
Gets an attribute from the underlying storage

Parameters:
key - The key of the attribute
Returns:
The data

removeAttribute

protected abstract void removeAttribute(java.lang.String key)
Removes an attribute from the underlying storage

Parameters:
key - The attribute to remove

getAttributeNames

protected abstract java.util.Enumeration<java.lang.String> getAttributeNames()
Gets an enumeration of the beans present in the underlying storage

Returns:
The current beans

setAttribute

protected abstract void setAttribute(java.lang.String key,
                                     java.lang.Object instance)
Sets an instance under a key in the underlying storage

Parameters:
key - The key
instance - The instance

getKeyPrefix

protected abstract java.lang.String getKeyPrefix()
Gets a key prefix that should be prefixed to names

Returns:
The prefix

getBeanKey

protected java.lang.String getBeanKey(Contextual<?> bean)
Returns a map key to a bean. Uses a known prefix and appends the index of the Bean in the Manager bean list.

Parameters:
bean - The bean to generate a key for.
Returns:
A unique key;


Copyright © 2008. All Rights Reserved.