* Get the collection entry for a collection passed to filter,
* which might be a collection wrapper, an array, or an unwrapped
* collection. Return null if there is no entry.
*/
public CollectionEntry getCollectionEntryOrNull(Object collection) {
PersistentCollection coll;
if ( collection instanceof PersistentCollection ) {
coll = (PersistentCollection) collection;
//if (collection==null) throw new TransientObjectException("Collection was not yet persistent");
}
else {
coll = getCollectionHolder(collection);
if ( coll == null ) {
//it might be an unwrapped collection reference!
//try to find a wrapper (slowish)
Iterator wrappers = IdentityMap.keyIterator(collectionEntries);
while ( wrappers.hasNext() ) {
PersistentCollection pc = (PersistentCollection) wrappers.next();
if ( pc.isWrapper(collection) ) {
coll = pc;
break;
}
}
}