Methods Summary |
---|
public void | beforeInitialize(org.hibernate.persister.collection.CollectionPersister persister, int anticipatedSize)
this.map = ( Map ) persister.getCollectionType().instantiate( anticipatedSize );
|
public void | clear()
if ( isClearQueueEnabled() ) {
queueOperation( new Clear() );
}
else {
initialize( true );
if ( ! map.isEmpty() ) {
dirty();
map.clear();
}
}
|
public boolean | containsKey(java.lang.Object key)
Boolean exists = readIndexExistence(key);
return exists==null ? map.containsKey(key) : exists.booleanValue();
|
public boolean | containsValue(java.lang.Object value)
Boolean exists = readElementExistence(value);
return exists==null ?
map.containsValue(value) :
exists.booleanValue();
|
public java.io.Serializable | disassemble(org.hibernate.persister.collection.CollectionPersister persister)
Serializable[] result = new Serializable[ map.size() * 2 ];
Iterator iter = map.entrySet().iterator();
int i=0;
while ( iter.hasNext() ) {
Map.Entry e = (Map.Entry) iter.next();
result[i++] = persister.getIndexType().disassemble( e.getKey(), getSession(), null );
result[i++] = persister.getElementType().disassemble( e.getValue(), getSession(), null );
}
return result;
|
public boolean | empty()
return map.isEmpty();
|
public java.util.Iterator | entries(org.hibernate.persister.collection.CollectionPersister persister)
return map.entrySet().iterator();
|
public boolean | entryExists(java.lang.Object entry, int i)
return ( (Map.Entry) entry ).getValue()!=null;
|
public java.util.Set | entrySet()
read();
return new EntrySetProxy( map.entrySet() );
|
public boolean | equals(java.lang.Object other)
read();
return map.equals(other);
|
public boolean | equalsSnapshot(org.hibernate.persister.collection.CollectionPersister persister)
Type elementType = persister.getElementType();
Map xmap = (Map) getSnapshot();
if ( xmap.size()!=this.map.size() ) return false;
Iterator iter = map.entrySet().iterator();
while ( iter.hasNext() ) {
Map.Entry entry = (Map.Entry) iter.next();
if ( elementType.isDirty( entry.getValue(), xmap.get( entry.getKey() ), getSession() ) ) return false;
}
return true;
|
public java.lang.Object | get(java.lang.Object key)
Object result = readElementByIndex(key);
return result==UNKNOWN ? map.get(key) : result;
|
public java.util.Iterator | getDeletes(org.hibernate.persister.collection.CollectionPersister persister, boolean indexIsFormula)
List deletes = new ArrayList();
Iterator iter = ( (Map) getSnapshot() ).entrySet().iterator();
while ( iter.hasNext() ) {
Map.Entry e = (Map.Entry) iter.next();
Object key = e.getKey();
if ( e.getValue()!=null && map.get(key)==null ) {
deletes.add( indexIsFormula ? e.getValue() : key );
}
}
return deletes.iterator();
|
public java.lang.Object | getElement(java.lang.Object entry)
return ( (Map.Entry) entry ).getValue();
|
public java.lang.Object | getIndex(java.lang.Object entry, int i, org.hibernate.persister.collection.CollectionPersister persister)
return ( (Map.Entry) entry ).getKey();
|
public java.util.Collection | getOrphans(java.io.Serializable snapshot, java.lang.String entityName)
Map sn = (Map) snapshot;
return getOrphans( sn.values(), map.values(), entityName, getSession() );
|
public java.io.Serializable | getSnapshot(org.hibernate.persister.collection.CollectionPersister persister)
EntityMode entityMode = getSession().getEntityMode();
HashMap clonedMap = new HashMap( map.size() );
Iterator iter = map.entrySet().iterator();
while ( iter.hasNext() ) {
Map.Entry e = (Map.Entry) iter.next();
final Object copy = persister.getElementType()
.deepCopy( e.getValue(), entityMode, persister.getFactory() );
clonedMap.put( e.getKey(), copy );
}
return clonedMap;
|
public java.lang.Object | getSnapshotElement(java.lang.Object entry, int i)
final Map sn = (Map) getSnapshot();
return sn.get( ( (Map.Entry) entry ).getKey() );
|
public int | hashCode()
read();
return map.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+=2 ) {
map.put(
persister.getIndexType().assemble( array[i], getSession(), owner ),
persister.getElementType().assemble( array[i+1], getSession(), owner )
);
}
|
public boolean | isEmpty()
return readSize() ? getCachedSize()==0 : map.isEmpty();
|
public boolean | isSnapshotEmpty(java.io.Serializable snapshot)
return ( (Map) snapshot ).isEmpty();
|
public boolean | isWrapper(java.lang.Object collection)
return map==collection;
|
public java.util.Set | keySet()
read();
return new SetProxy( map.keySet() );
|
public boolean | needsInserting(java.lang.Object entry, int i, org.hibernate.type.Type elemType)
final Map sn = (Map) getSnapshot();
Map.Entry e = (Map.Entry) entry;
return e.getValue()!=null && sn.get( e.getKey() )==null;
|
public boolean | needsUpdating(java.lang.Object entry, int i, org.hibernate.type.Type elemType)
final Map sn = (Map) getSnapshot();
Map.Entry e = (Map.Entry) entry;
Object snValue = sn.get( e.getKey() );
return e.getValue()!=null &&
snValue!=null &&
elemType.isDirty( snValue, e.getValue(), getSession() );
|
public java.lang.Object | put(java.lang.Object key, java.lang.Object value)
if ( isPutQueueEnabled() ) {
Object old = readElementByIndex( key );
if ( old != UNKNOWN ) {
queueOperation( new Put( key, value, old ) );
return old;
}
}
initialize( true );
Object old = map.put( key, value );
// would be better to use the element-type to determine
// whether the old and the new are equal here; the problem being
// we do not necessarily have access to the element type in all
// cases
if ( value != old ) {
dirty();
}
return old;
|
public void | putAll(java.util.Map puts)
if ( puts.size()>0 ) {
initialize( true );
Iterator itr = puts.entrySet().iterator();
while ( itr.hasNext() ) {
Map.Entry entry = ( Entry ) itr.next();
put( entry.getKey(), entry.getValue() );
}
}
|
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() );
Object index = persister.readIndex( rs, descriptor.getSuffixedIndexAliases(), getSession() );
if ( element!=null ) map.put(index, element);
return element;
|
public java.lang.Object | remove(java.lang.Object key)
if ( isPutQueueEnabled() ) {
Object old = readElementByIndex( key );
queueOperation( new Remove( key, old ) );
return old;
}
else {
// TODO : safe to interpret "map.remove(key) == null" as non-dirty?
initialize( true );
if ( map.containsKey( key ) ) {
dirty();
}
return map.remove( key );
}
|
public int | size()
return readSize() ? getCachedSize() : map.size();
|
public java.lang.String | toString()
read();
return map.toString();
|
public java.util.Collection | values()
read();
return new SetProxy( map.values() );
|