logahawk
Class AbstractContainer<T>

java.lang.Object
  extended by logahawk.AbstractContainer<T>
Direct Known Subclasses:
DefaultArgumentFormatterContainer, DefaultListenerContainer, DefaultSignatureFormatterContainer, MultiLogger

@ThreadSafe
public abstract class AbstractContainer<T>
extends Object

An abstract base class to help implement the various container classes such as ArgumentFormatterContainer, SignatureFormatterContainer, ListenerContainer, etc. This class is thread-safe (but the same guarantee is not made for the individual items).


Field Summary
protected  CopyOnWriteArrayList<T> items
           
 
Constructor Summary
protected AbstractContainer()
           
protected AbstractContainer(Collection<T> c)
          Adds the provided items to this container.
 
Method Summary
 void add(T... c)
          Adds the items in the order they provided.
 void addAll(Collection<T> c)
          Adds the items in the order they provided.
 void clear()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

items

protected final CopyOnWriteArrayList<T> items
Constructor Detail

AbstractContainer

protected AbstractContainer()

AbstractContainer

protected AbstractContainer(Collection<T> c)
Adds the provided items to this container. (The provided Collection is not used, a shallow copy is made.)

Method Detail

add

public void add(T... c)
Adds the items in the order they provided. The items will be used (in the appropriate fashion) in the same order. The default implementation of this method calls addAll(Collection) with a new Collection created from a call to Arrays.asList(Object[]), so many implementations can simply override addAll(Collection).


addAll

public void addAll(Collection<T> c)
Adds the items in the order they provided. The items will be used (in the appropriate fashion) in the same order.


clear

public void clear()