Methods Summary |
---|
public void | beforeInitialize(org.hibernate.persister.collection.CollectionPersister persister, int anticipatedSize)
//if (tempList==null) throw new UnsupportedOperationException("Can't lazily initialize arrays");
|
public void | beginRead()
super.beginRead();
tempList = new ArrayList();
|
public java.io.Serializable | disassemble(org.hibernate.persister.collection.CollectionPersister persister)
int length = Array.getLength(array);
Serializable[] result = new Serializable[length];
for ( int i=0; i<length; i++ ) {
result[i] = persister.getElementType().disassemble( Array.get(array,i), getSession(), null );
}
/*int length = tempList.size();
Serializable[] result = new Serializable[length];
for ( int i=0; i<length; i++ ) {
result[i] = persister.getElementType().disassemble( tempList.get(i), session );
}*/
return result;
|
public java.util.Iterator | elements()
//if (array==null) return tempList.iterator();
int length = Array.getLength(array);
java.util.List list = new ArrayList(length);
for (int i=0; i<length; i++) {
list.add( Array.get(array, i) );
}
return list.iterator();
|
public boolean | empty()
return false;
|
public boolean | endRead()
setInitialized();
array = Array.newInstance( elementClass, tempList.size() );
for ( int i=0; i<tempList.size(); i++) {
Array.set(array, i, tempList.get(i) );
}
tempList=null;
return true;
|
public java.util.Iterator | entries(org.hibernate.persister.collection.CollectionPersister persister)
return elements();
|
public boolean | entryExists(java.lang.Object entry, int i)
return entry!=null;
|
public boolean | equalsSnapshot(org.hibernate.persister.collection.CollectionPersister persister)
Type elementType = persister.getElementType();
Serializable snapshot = getSnapshot();
int xlen = Array.getLength(snapshot);
if ( xlen!= Array.getLength(array) ) return false;
for ( int i=0; i<xlen; i++) {
if ( elementType.isDirty( Array.get(snapshot, i), Array.get(array, i), getSession() ) ) return false;
}
return true;
|
public java.lang.Object | getArray()
return array;
|
public java.util.Iterator | getDeletes(org.hibernate.persister.collection.CollectionPersister persister, boolean indexIsFormula)
java.util.List deletes = new ArrayList();
Serializable sn = getSnapshot();
int snSize = Array.getLength(sn);
int arraySize = Array.getLength(array);
int end;
if ( snSize > arraySize ) {
for ( int i=arraySize; i<snSize; i++ ) deletes.add( new Integer(i) );
end = arraySize;
}
else {
end = snSize;
}
for ( int i=0; i<end; i++ ) {
if ( Array.get(array, i)==null && Array.get(sn, i)!=null ) deletes.add( new Integer(i) );
}
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)
return new Integer(i);
|
public java.util.Collection | getOrphans(java.io.Serializable snapshot, java.lang.String entityName)
Object[] sn = (Object[]) snapshot;
Object[] arr = (Object[]) array;
ArrayList result = new ArrayList();
for (int i=0; i<sn.length; i++) result.add( sn[i] );
for (int i=0; i<sn.length; i++) identityRemove( result, arr[i], entityName, getSession() );
return result;
|
public java.io.Serializable | getSnapshot(org.hibernate.persister.collection.CollectionPersister persister)
EntityMode entityMode = getSession().getEntityMode();
int length = /*(array==null) ? tempList.size() :*/ Array.getLength(array);
Serializable result = (Serializable) Array.newInstance( persister.getElementClass(), length );
for ( int i=0; i<length; i++ ) {
Object elt = /*(array==null) ? tempList.get(i) :*/ Array.get(array, i);
try {
Array.set( result, i, persister.getElementType().deepCopy(elt, entityMode, persister.getFactory()) );
}
catch (IllegalArgumentException iae) {
log.error("Array element type error", iae);
throw new HibernateException( "Array element type error", iae );
}
}
return result;
|
public java.lang.Object | getSnapshotElement(java.lang.Object entry, int i)
Serializable sn = getSnapshot();
return Array.get(sn, i);
|
public java.lang.Object | getValue()
return array;
|
public void | initializeFromCache(org.hibernate.persister.collection.CollectionPersister persister, java.io.Serializable disassembled, java.lang.Object owner)
Serializable[] cached = (Serializable[]) disassembled;
array = Array.newInstance( persister.getElementClass(), cached.length );
for ( int i=0; i<cached.length; i++ ) {
Array.set( array, i, persister.getElementType().assemble( cached[i], getSession(), owner ) );
}
|
public boolean | isDirectlyAccessible()
return true;
|
public boolean | isSnapshotEmpty(java.io.Serializable snapshot)
return Array.getLength( snapshot ) == 0;
|
public boolean | isWrapper(java.lang.Object collection)
return array==collection;
|
public boolean | needsInserting(java.lang.Object entry, int i, org.hibernate.type.Type elemType)
Serializable sn = getSnapshot();
return Array.get(array, i)!=null && ( i >= Array.getLength(sn) || Array.get(sn, i)==null );
|
public boolean | needsUpdating(java.lang.Object entry, int i, org.hibernate.type.Type elemType)
Serializable sn = getSnapshot();
return i<Array.getLength(sn) &&
Array.get(sn, i)!=null &&
Array.get(array, i)!=null &&
elemType.isDirty( Array.get(array, i), Array.get(sn, i), getSession() );
|
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() );
int index = ( (Integer) persister.readIndex( rs, descriptor.getSuffixedIndexAliases(), getSession() ) ).intValue();
for ( int i = tempList.size(); i<=index; i++) {
tempList.add(i, null);
}
tempList.set(index, element);
return element;
|