org.jboss.system.server.profileservice.repository.clustered.metadata
Class AbstractSortedMetadataContainer<K,T extends Identifiable<K>>

java.lang.Object
  extended by org.jboss.system.server.profileservice.repository.clustered.metadata.AbstractSortedMetadataContainer<K,T>
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
RepositoryContentMetadata, RepositoryRootMetadata

public abstract class AbstractSortedMetadataContainer<K,T extends Identifiable<K>>
extends Object
implements Serializable

Base class for objects that maintain a sorted collection of child Identifiable metadata and also provide efficient lookup capability based on a child item's id.

Version:
$Revision: $
Author:
Brian Stansberry
See Also:
Serialized Form

Field Summary
protected  SortedSet<T> sortedItems
           
 
Constructor Summary
AbstractSortedMetadataContainer()
           
 
Method Summary
protected  T getContainedMetadata(K key)
          Gets the metadata object identified by key.
protected  Set<K> getContainedMetadataIds()
          Gets an unmodifiable view of the ids of the metadata stored in this container.
protected  Collection<T> getExposedCollection()
          Gets a collection that can be exposed to external callers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sortedItems

protected SortedSet<T extends Identifiable<K>> sortedItems
Constructor Detail

AbstractSortedMetadataContainer

public AbstractSortedMetadataContainer()
Method Detail

getExposedCollection

protected Collection<T> getExposedCollection()
Gets a collection that can be exposed to external callers. Modifications to the collection affect the internal state of this object. The iterator exposed by this collection will provide items ordered by the natural ordering of T. The returned collection is not thread safe.


getContainedMetadata

protected T getContainedMetadata(K key)
Gets the metadata object identified by key.

Parameters:
key - the key
Returns:
the metadata, or null if key is unknown.

getContainedMetadataIds

protected Set<K> getContainedMetadataIds()
Gets an unmodifiable view of the ids of the metadata stored in this container.

Returns:
the ids. Will not be null.


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.