MapTypepublic class MapType extends CollectionType
Constructors Summary |
---|
public MapType(String role, String propertyRef, boolean isEmbeddedInXML)
super(role, propertyRef, isEmbeddedInXML);
|
Methods Summary |
---|
public java.util.Iterator | getElementsIterator(java.lang.Object collection)
return ( (java.util.Map) collection ).values().iterator();
| public java.lang.Class | getReturnedClass()
return Map.class;
| public java.lang.Object | indexOf(java.lang.Object collection, java.lang.Object element)
Iterator iter = ( (Map) collection ).entrySet().iterator();
while ( iter.hasNext() ) {
Map.Entry me = (Map.Entry) iter.next();
//TODO: proxies!
if ( me.getValue()==element ) return me.getKey();
}
return null;
| public org.hibernate.collection.PersistentCollection | instantiate(org.hibernate.engine.SessionImplementor session, org.hibernate.persister.collection.CollectionPersister persister, java.io.Serializable key)
if ( session.getEntityMode()==EntityMode.DOM4J ) {
return new PersistentMapElementHolder(session, persister, key);
}
else {
return new PersistentMap(session);
}
| public java.lang.Object | instantiate(int anticipatedSize)
return anticipatedSize <= 0
? new HashMap()
: new HashMap( anticipatedSize + (int)( anticipatedSize * .75f ), .75f );
| public java.lang.Object | replaceElements(java.lang.Object original, java.lang.Object target, java.lang.Object owner, java.util.Map copyCache, org.hibernate.engine.SessionImplementor session)
CollectionPersister cp = session.getFactory().getCollectionPersister( getRole() );
java.util.Map result = (java.util.Map) target;
result.clear();
Iterator iter = ( (java.util.Map) original ).entrySet().iterator();
while ( iter.hasNext() ) {
java.util.Map.Entry me = (java.util.Map.Entry) iter.next();
Object key = cp.getIndexType().replace( me.getKey(), null, session, owner, copyCache );
Object value = cp.getElementType().replace( me.getValue(), null, session, owner, copyCache );
result.put(key, value);
}
return result;
| public org.hibernate.collection.PersistentCollection | wrap(org.hibernate.engine.SessionImplementor session, java.lang.Object collection)
if ( session.getEntityMode()==EntityMode.DOM4J ) {
return new PersistentMapElementHolder( session, (Element) collection );
}
else {
return new PersistentMap( session, (java.util.Map) collection );
}
|
|