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

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

public final class LazyHashSet<E>
extends Object
implements LazyCollection<E>, 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, List<Identity> ids)
          Creates an instance of LazyHashSet.
 
Method Summary
 boolean add(E entity)
           
 boolean addAll(Collection<? extends E> collection)
           
 void clear()
           
 void committed(TransactionContext tx)
          Called at the end of a transaction after commit.
 boolean contains(Object entity)
           
 boolean containsAll(Collection<?> collection)
           
 boolean equals(Object o)
           
 List<E> getAddedEntitiesList()
           
 List<Identity> getIdsList()
           
 List<Identity> getRemovedIdsList()
           
 int hashCode()
           
 boolean isEmpty()
           
 Iterator<E> iterator()
           
 boolean remove(Object entity)
           
 boolean removeAll(Collection<?> collection)
           
 boolean retainAll(Collection<?> collection)
           
 void rolledback(TransactionContext tx)
          Called at the end of a transaction after rollback.
 int size()
           
 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,
                   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 Collection<E>
Specified by:
add in interface Set<E>

addAll

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

clear

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

contains

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

containsAll

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

isEmpty

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

iterator

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

remove

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

removeAll

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

retainAll

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

size

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

toArray

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

toArray

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

equals

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

hashCode

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

getIdsList

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

getRemovedIdsList

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

getAddedEntitiesList

public 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


Copyright © 2011. All Rights Reserved.