站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Hibernate 2.1.8 正式版 API 英文文档

Map (Hibernate API Documentation) - Hibernate 2.1.8 正式版 API 英文文档


net.sf.hibernate.collection
Class Map

java.lang.Object
  extended bynet.sf.hibernate.collection.PersistentCollection
      extended bynet.sf.hibernate.collection.Map
All Implemented Interfaces:
org.odmg.DMap, Map, Serializable
Direct Known Subclasses:
SortedMap

public class Map
extends PersistentCollection
implements Map, org.odmg.DMap

A persistent wrapper for a java.util.Map. Underlying collection is a HashMap.

Author:
Gavin King
See Also:
HashMap, Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.util.Map
Map.Entry
 
Constructor Summary
Map()
           
Map(SessionImplementor session)
           
Map(SessionImplementor session, Map map)
           
 
Method Summary
 void beforeInitialize(CollectionPersister persister)
          Called before any elements are read into the collection, allowing appropriate initializations to occur.
 void clear()
           
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
           
 Serializable disassemble(CollectionPersister persister)
          Disassemble the collection, ready for the cache
 boolean empty()
          Is the initialized collection empty?
 Iterator entries()
          Iterate all collection entries, during update of the database
 boolean entryExists(Object entry, int i)
          Does an element exist at this entry in the collection?
 Set entrySet()
           
 boolean equals(Object other)
           
 boolean equalsSnapshot(Type elementType)
          Does the current state exactly match the snapshot?
 Object get(Object key)
           
 Iterator getDeletes(Type elemType)
          Get all the elements that need deleting
 Object getIndex(Object entry, int i)
          Get the index of the given collection entry
 Collection getOrphans(Serializable snapshot)
          get all "orphaned" elements
 int hashCode()
           
 void initializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner)
          Read the state of the collection from a disassembled cached value
 boolean isEmpty()
           
 boolean isWrapper(Object collection)
          Is this the wrapper for the given underlying collection instance?
 Set keySet()
           
 boolean needsInserting(Object entry, int i, Type elemType)
          Do we need to insert this element?
 boolean needsUpdating(Object entry, int i, Type elemType)
          Do we need to update this element?
 Object put(Object key, Object value)
           
 void putAll(Map puts)
           
 Object readFrom(ResultSet rs, CollectionPersister persister, Object owner)
          Read a row from the JDBC result set
 Object remove(Object key)
           
 int size()
           
protected  Serializable snapshot(CollectionPersister persister)
          Return a new snapshot of the current state
 String toString()
           
 Collection values()
           
 void writeTo(PreparedStatement st, CollectionPersister persister, Object entry, int i, boolean writeOrder)
          Write a row to the JDBC prepared statement
 
Methods inherited from class net.sf.hibernate.collection.PersistentCollection
afterRowInsert, beginRead, delayedAddAll, endRead, forceInitialization, getCollectionSnapshot, getOrphans, getSession, getSnapshot, getSnapshot, getValue, hasQueuedAdditions, initialize, isDirectlyAccessible, needsRecreate, postFlush, preInsert, queueAdd, queueAddAll, queuedAdditionIterator, read, setCollectionSnapshot, setCurrentSession, setDirectlyAccessible, setInitialized, unsetSession, wasInitialized, write
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Map

public Map(SessionImplementor session)

Map

public Map()

Map

public Map(SessionImplementor session,
           Map map)
Method Detail

snapshot

protected Serializable snapshot(CollectionPersister persister)
                         throws HibernateException
Description copied from class: PersistentCollection
Return a new snapshot of the current state

Specified by:
snapshot in class PersistentCollection
Throws:
HibernateException

getOrphans

public Collection getOrphans(Serializable snapshot)
                      throws HibernateException
Description copied from class: PersistentCollection
get all "orphaned" elements

Specified by:
getOrphans in class PersistentCollection
Throws:
HibernateException

equalsSnapshot

public boolean equalsSnapshot(Type elementType)
                       throws HibernateException
Description copied from class: PersistentCollection
Does the current state exactly match the snapshot?

Specified by:
equalsSnapshot in class PersistentCollection
Throws:
HibernateException

isWrapper

public boolean isWrapper(Object collection)
Description copied from class: PersistentCollection
Is this the wrapper for the given underlying collection instance?

Specified by:
isWrapper in class PersistentCollection

beforeInitialize

public void beforeInitialize(CollectionPersister persister)
Description copied from class: PersistentCollection
Called before any elements are read into the collection, allowing appropriate initializations to occur.

Specified by:
beforeInitialize in class PersistentCollection

size

public int size()
Specified by:
size in interface Map
See Also:
Map.size()

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map
See Also:
Map.isEmpty()

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map
See Also:
Map.containsKey(Object)

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map
See Also:
Map.containsValue(Object)

get

public Object get(Object key)
Specified by:
get in interface Map
See Also:
Map.get(Object)

put

public Object put(Object key,
                  Object value)
Specified by:
put in interface Map
See Also:
Map.put(Object, Object)

remove

public Object remove(Object key)
Specified by:
remove in interface Map
See Also:
Map.remove(Object)

putAll

public void putAll(Map puts)
Specified by:
putAll in interface Map
See Also:
Map.putAll(java.util.Map puts)

clear

public void clear()
Specified by:
clear in interface Map
See Also:
Map.clear()

keySet

public Set keySet()
Specified by:
keySet in interface Map
See Also:
Map.keySet()

values

public Collection values()
Specified by:
values in interface Map
See Also:
Map.values()

entrySet

public Set entrySet()
Specified by:
entrySet in interface Map
See Also:
Map.entrySet()

empty

public boolean empty()
Description copied from class: PersistentCollection
Is the initialized collection empty?

Specified by:
empty in class PersistentCollection

toString

public String toString()

writeTo

public void writeTo(PreparedStatement st,
                    CollectionPersister persister,
                    Object entry,
                    int i,
                    boolean writeOrder)
             throws HibernateException,
                    SQLException
Description copied from class: PersistentCollection
Write a row to the JDBC prepared statement

Specified by:
writeTo in class PersistentCollection
Throws:
HibernateException
SQLException
See Also:
PersistentCollection.writeTo(PreparedStatement, CollectionPersister, Object, int, boolean)

readFrom

public Object readFrom(ResultSet rs,
                       CollectionPersister persister,
                       Object owner)
                throws HibernateException,
                       SQLException
Description copied from class: PersistentCollection
Read a row from the JDBC result set

Specified by:
readFrom in class PersistentCollection
Throws:
HibernateException
SQLException
See Also:
PersistentCollection.readFrom(ResultSet, CollectionPersister, Object)

entries

public Iterator entries()
Description copied from class: PersistentCollection
Iterate all collection entries, during update of the database

Specified by:
entries in class PersistentCollection
See Also:
PersistentCollection.entries()

initializeFromCache

public void initializeFromCache(CollectionPersister persister,
                                Serializable disassembled,
                                Object owner)
                         throws HibernateException
Description copied from class: PersistentCollection
Read the state of the collection from a disassembled cached value

Specified by:
initializeFromCache in class PersistentCollection
Throws:
HibernateException

disassemble

public Serializable disassemble(CollectionPersister persister)
                         throws HibernateException
Description copied from class: PersistentCollection
Disassemble the collection, ready for the cache

Specified by:
disassemble in class PersistentCollection
Throws:
HibernateException

getDeletes

public Iterator getDeletes(Type elemType)
                    throws HibernateException
Description copied from class: PersistentCollection
Get all the elements that need deleting

Specified by:
getDeletes in class PersistentCollection
Throws:
HibernateException

needsInserting

public boolean needsInserting(Object entry,
                              int i,
                              Type elemType)
                       throws HibernateException
Description copied from class: PersistentCollection
Do we need to insert this element?

Specified by:
needsInserting in class PersistentCollection
Throws:
HibernateException

needsUpdating

public boolean needsUpdating(Object entry,
                             int i,
                             Type elemType)
                      throws HibernateException
Description copied from class: PersistentCollection
Do we need to update this element?

Specified by:
needsUpdating in class PersistentCollection
Throws:
HibernateException

getIndex

public Object getIndex(Object entry,
                       int i)
Description copied from class: PersistentCollection
Get the index of the given collection entry

Specified by:
getIndex in class PersistentCollection

equals

public boolean equals(Object other)
Specified by:
equals in interface Map

hashCode

public int hashCode()
Specified by:
hashCode in interface Map

entryExists

public boolean entryExists(Object entry,
                           int i)
Description copied from class: PersistentCollection
Does an element exist at this entry in the collection?

Specified by:
entryExists in class PersistentCollection
See Also:
PersistentCollection.entryExists(java.lang.Object, int)