Methods Summary |
---|
public boolean | add(java.lang.Object value)
Boolean exists = isOperationQueueEnabled() ? readElementExistence( value ) : null;
if ( exists == null ) {
initialize( true );
if ( set.add( value ) ) {
dirty();
return true;
}
else {
return false;
}
}
else if ( exists.booleanValue() ) {
return false;
}
else {
queueOperation( new SimpleAdd(value) );
return true;
}
|
public boolean | addAll(java.util.Collection coll)
if ( coll.size() > 0 ) {
initialize( true );
if ( set.addAll( coll ) ) {
dirty();
return true;
}
else {
return false;
}
}
else {
return false;
}
|
public void | beforeInitialize(org.hibernate.persister.collection.CollectionPersister persister, int anticipatedSize)
this.set = ( Set ) persister.getCollectionType().instantiate( anticipatedSize );
|
public void | beginRead()
super.beginRead();
tempList = new ArrayList();
|
public void | clear()
if ( isClearQueueEnabled() ) {
queueOperation( new Clear() );
}
else {
initialize( true );
if ( !set.isEmpty() ) {
set.clear();
dirty();
}
}
|
public boolean | contains(java.lang.Object object)
Boolean exists = readElementExistence(object);
return exists==null ?
set.contains(object) :
exists.booleanValue();
|
public boolean | containsAll(java.util.Collection coll)
read();
return set.containsAll(coll);
|
public java.io.Serializable | disassemble(org.hibernate.persister.collection.CollectionPersister persister)
Serializable[] result = new Serializable[ set.size() ];
Iterator iter = set.iterator();
int i=0;
while ( iter.hasNext() ) {
result[i++] = persister.getElementType().disassemble( iter.next(), getSession(), null );
}
return result;
|
public boolean | empty()
return set.isEmpty();
|
public boolean | endRead()
set.addAll(tempList);
tempList = null;
setInitialized();
return true;
|
public java.util.Iterator | entries(org.hibernate.persister.collection.CollectionPersister persister)
return set.iterator();
|
public boolean | entryExists(java.lang.Object key, int i)
return true;
|
public boolean | equals(java.lang.Object other)
read();
return set.equals(other);
|
public boolean | equalsSnapshot(org.hibernate.persister.collection.CollectionPersister persister)
Type elementType = persister.getElementType();
java.util.Map sn = (java.util.Map) getSnapshot();
if ( sn.size()!=set.size() ) {
return false;
}
else {
Iterator iter = set.iterator();
while ( iter.hasNext() ) {
Object test = iter.next();
Object oldValue = sn.get(test);
if ( oldValue==null || elementType.isDirty( oldValue, test, getSession() ) ) return false;
}
return true;
}
|
public java.util.Iterator | getDeletes(org.hibernate.persister.collection.CollectionPersister persister, boolean indexIsFormula)
Type elementType = persister.getElementType();
final java.util.Map sn = (java.util.Map) getSnapshot();
ArrayList deletes = new ArrayList( sn.size() );
Iterator iter = sn.keySet().iterator();
while ( iter.hasNext() ) {
Object test = iter.next();
if ( !set.contains(test) ) {
// the element has been removed from the set
deletes.add(test);
}
}
iter = set.iterator();
while ( iter.hasNext() ) {
Object test = iter.next();
Object oldValue = sn.get(test);
if ( oldValue!=null && elementType.isDirty( test, oldValue, getSession() ) ) {
// the element has changed
deletes.add(oldValue);
}
}
return deletes.iterator();
|
public java.lang.Object | getElement(java.lang.Object entry)
return entry;
|
public java.lang.Object | getIndex(java.lang.Object entry, int i, org.hibernate.persister.collection.CollectionPersister persister)
throw new UnsupportedOperationException("Sets don't have indexes");
|
public java.util.Collection | getOrphans(java.io.Serializable snapshot, java.lang.String entityName)
java.util.Map sn = (java.util.Map) snapshot;
return getOrphans( sn.keySet(), set, entityName, getSession() );
|
public java.io.Serializable | getSnapshot(org.hibernate.persister.collection.CollectionPersister persister)
EntityMode entityMode = getSession().getEntityMode();
//if (set==null) return new Set(session);
HashMap clonedSet = new HashMap( set.size() );
Iterator iter = set.iterator();
while ( iter.hasNext() ) {
Object copied = persister.getElementType()
.deepCopy( iter.next(), entityMode, persister.getFactory() );
clonedSet.put(copied, copied);
}
return clonedSet;
|
public java.lang.Object | getSnapshotElement(java.lang.Object entry, int i)
throw new UnsupportedOperationException("Sets don't support updating by element");
|
public int | hashCode()
read();
return set.hashCode();
|
public void | initializeFromCache(org.hibernate.persister.collection.CollectionPersister persister, java.io.Serializable disassembled, java.lang.Object owner)
Serializable[] array = ( Serializable[] ) disassembled;
int size = array.length;
beforeInitialize( persister, size );
for (int i = 0; i < size; i++ ) {
Object element = persister.getElementType().assemble( array[i], getSession(), owner );
if ( element != null ) {
set.add( element );
}
}
|
public boolean | isEmpty()
return readSize() ? getCachedSize()==0 : set.isEmpty();
|
public boolean | isRowUpdatePossible()
return false;
|
public boolean | isSnapshotEmpty(java.io.Serializable snapshot)
return ( (java.util.Map) snapshot ).isEmpty();
|
public boolean | isWrapper(java.lang.Object collection)
return set==collection;
|
public java.util.Iterator | iterator()
read();
return new IteratorProxy( set.iterator() );
|
public boolean | needsInserting(java.lang.Object entry, int i, org.hibernate.type.Type elemType)
final java.util.Map sn = (java.util.Map) getSnapshot();
Object oldValue = sn.get(entry);
// note that it might be better to iterate the snapshot but this is safe,
// assuming the user implements equals() properly, as required by the Set
// contract!
return oldValue==null || elemType.isDirty( oldValue, entry, getSession() );
|
public boolean | needsUpdating(java.lang.Object entry, int i, org.hibernate.type.Type elemType)
return false;
|
public java.lang.Object | readFrom(java.sql.ResultSet rs, org.hibernate.persister.collection.CollectionPersister persister, org.hibernate.loader.CollectionAliases descriptor, java.lang.Object owner)
Object element = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() );
if (element!=null) tempList.add(element);
return element;
|
public boolean | remove(java.lang.Object value)
Boolean exists = isPutQueueEnabled() ? readElementExistence( value ) : null;
if ( exists==null ) {
initialize( true );
if ( set.remove( value ) ) {
dirty();
return true;
}
else {
return false;
}
}
else if ( exists.booleanValue() ) {
queueOperation( new SimpleRemove(value) );
return true;
}
else {
return false;
}
|
public boolean | removeAll(java.util.Collection coll)
if ( coll.size() > 0 ) {
initialize( true );
if ( set.removeAll( coll ) ) {
dirty();
return true;
}
else {
return false;
}
}
else {
return false;
}
|
public boolean | retainAll(java.util.Collection coll)
initialize( true );
if ( set.retainAll( coll ) ) {
dirty();
return true;
}
else {
return false;
}
|
public int | size()
return readSize() ? getCachedSize() : set.size();
|
public java.lang.Object[] | toArray()
read();
return set.toArray();
|
public java.lang.Object[] | toArray(java.lang.Object[] array)
read();
return set.toArray(array);
|
public java.lang.String | toString()
//if (needLoading) return "asleep";
read();
return set.toString();
|