org.castor.persist.proxy
Class LazyHashSet<E>

java.lang.Object
  extended by org.castor.persist.proxy.LazyHashSet<E>
All Implemented Interfaces:
java.lang.Iterable<E>, java.util.Collection<E>, java.util.Set<E>, LazyCollection<E>, TxSynchronizable

public final class LazyHashSet<E>
extends java.lang.Object
implements LazyCollection<E>, java.util.Set<E>

It is a lazy Collection. The collection initially contains only the identities of elements of one type. If any element is needed, it will be fetched "on the fly".

Version:
$Revision$ $Date: 2009-07-13 17:22:43 (Mon, 13 Jul 2009) $
Author:
Thomas Yip, Werner Guttmann, Ralf Joachim

Constructor Summary
LazyHashSet(TransactionContext tx, ClassMolder molder, java.util.List<Identity> ids)
          Creates an instance of LazyHashSet.
 
Method Summary
 boolean add(E entity)
           
 boolean addAll(java.util.Collection<? extends E> collection)
           
 void clear()
           
 void committed(TransactionContext tx)
          Called at the end of a transaction after commit.
 boolean contains(java.lang.Object entity)
           
 boolean containsAll(java.util.Collection<?> collection)
           
 boolean equals(java.lang.Object o)
           
 java.util.List<E> getAddedEntitiesList()
           
 java.util.List<Identity> getIdsList()
           
 java.util.List<Identity> getRemovedIdsList()
           
 int hashCode()
           
 boolean isEmpty()
           
 java.util.Iterator<E> iterator()
           
 boolean remove(java.lang.Object entity)
           
 boolean removeAll(java.util.Collection<?> collection)
           
 boolean retainAll(java.util.Collection<?> collection)
           
 void rolledback(TransactionContext tx)
          Called at the end of a transaction after rollback.
 int size()
           
 java.lang.Object[] toArray()
           
<A> A[]
toArray(A[] array)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LazyHashSet

public LazyHashSet(TransactionContext tx,
                   ClassMolder molder,
                   java.util.List<Identity> ids)
Creates an instance of LazyHashSet.

Parameters:
tx - Current transaction context
molder - Associated ClassMolder
ids - Set of identifiers.
Method Detail

add

public boolean add(E entity)
Specified by:
add in interface java.util.Collection<E>
Specified by:
add in interface java.util.Set<E>

addAll

public boolean addAll(java.util.Collection<? extends E> collection)
Specified by:
addAll in interface java.util.Collection<E>
Specified by:
addAll in interface java.util.Set<E>

clear

public void clear()
Specified by:
clear in interface java.util.Collection<E>
Specified by:
clear in interface java.util.Set<E>

contains

public boolean contains(java.lang.Object entity)
Specified by:
contains in interface java.util.Collection<E>
Specified by:
contains in interface java.util.Set<E>

containsAll

public boolean containsAll(java.util.Collection<?> collection)
Specified by:
containsAll in interface java.util.Collection<E>
Specified by:
containsAll in interface java.util.Set<E>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection<E>
Specified by:
isEmpty in interface java.util.Set<E>

iterator

public java.util.Iterator<E> iterator()
Specified by:
iterator in interface java.lang.Iterable<E>
Specified by:
iterator in interface java.util.Collection<E>
Specified by:
iterator in interface java.util.Set<E>

remove

public boolean remove(java.lang.Object entity)
Specified by:
remove in interface java.util.Collection<E>
Specified by:
remove in interface java.util.Set<E>

removeAll

public boolean removeAll(java.util.Collection<?> collection)
Specified by:
removeAll in interface java.util.Collection<E>
Specified by:
removeAll in interface java.util.Set<E>

retainAll

public boolean retainAll(java.util.Collection<?> collection)
Specified by:
retainAll in interface java.util.Collection<E>
Specified by:
retainAll in interface java.util.Set<E>

size

public int size()
Specified by:
size in interface java.util.Collection<E>
Specified by:
size in interface java.util.Set<E>

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection<E>
Specified by:
toArray in interface java.util.Set<E>

toArray

public <A> A[] toArray(A[] array)
Specified by:
toArray in interface java.util.Collection<E>
Specified by:
toArray in interface java.util.Set<E>

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface java.util.Collection<E>
Specified by:
equals in interface java.util.Set<E>
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Collection<E>
Specified by:
hashCode in interface java.util.Set<E>
Overrides:
hashCode in class java.lang.Object

getIdsList

public java.util.List<Identity> getIdsList()
Specified by:
getIdsList in interface LazyCollection<E>

getRemovedIdsList

public java.util.List<Identity> getRemovedIdsList()
Specified by:
getRemovedIdsList in interface LazyCollection<E>

getAddedEntitiesList

public java.util.List<E> getAddedEntitiesList()
Specified by:
getAddedEntitiesList in interface LazyCollection<E>

committed

public void committed(TransactionContext tx)
Description copied from interface: TxSynchronizable
Called at the end of a transaction after commit.

Specified by:
committed in interface TxSynchronizable

rolledback

public void rolledback(TransactionContext tx)
Description copied from interface: TxSynchronizable
Called at the end of a transaction after rollback.

Specified by:
rolledback in interface TxSynchronizable


Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com