Package org.hibernate.engine.spi
Class ExecutableList<E extends Executable & java.lang.Comparable & java.io.Serializable>
- java.lang.Object
-
- org.hibernate.engine.spi.ExecutableList<E>
-
- Type Parameters:
E- Intersection type describing Executable implementations
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable,java.lang.Iterable<E>
public class ExecutableList<E extends Executable & java.lang.Comparable & java.io.Serializable> extends java.lang.Object implements java.io.Serializable, java.lang.Iterable<E>, java.io.ExternalizableSpecialized encapsulating of the state pertaining to each Executable list. Manages sorting the executables (lazily) Manages the querySpaces affected by the executables in the list, and caches this too.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceExecutableList.Sorter<E extends Executable>Provides a sorting interface for ExecutableList.
-
Field Summary
Fields Modifier and Type Field Description static intINIT_QUEUE_LIST_SIZE
-
Constructor Summary
Constructors Constructor Description ExecutableList()Creates a new ExecutableList with the default settings.ExecutableList(boolean requiresSorting)ExecutableList(int initialCapacity)Creates a new ExecutableList with the specified initialCapacity.ExecutableList(int initialCapacity, boolean requiresSorting)ExecutableList(int initialCapacity, ExecutableList.Sorter<E> sorter)Creates a new ExecutableList with the specified initialCapacity and Sorter.ExecutableList(ExecutableList.Sorter<E> sorter)Creates a new ExecutableList using the specified Sorter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(E executable)Add an Executable to this list.voidafterDeserialize(SessionImplementor session)Allow the Executables to re-associate themselves with the Session after deserialization.voidclear()Clears the list of executions.Eget(int index)java.util.Set<java.io.Serializable>getQuerySpaces()Lazily constructs the querySpaces affected by the actions in the list.booleanisEmpty()java.util.Iterator<E>iterator()Returns an iterator for the list.voidreadExternal(java.io.ObjectInput in)Read this object state back in from the given stream as part of de-serializationEremove(int index)Removes the entry at position index in the list.voidremoveLastN(int n)Removes the last n entries from the list.intsize()voidsort()Sorts the list using the natural ordering or using the Sorter if it's not null.java.lang.StringtoString()voidwriteExternal(java.io.ObjectOutput oos)Write this list out to the given stream as part of serialization
-
-
-
Field Detail
-
INIT_QUEUE_LIST_SIZE
public static final int INIT_QUEUE_LIST_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ExecutableList
public ExecutableList()
Creates a new ExecutableList with the default settings.
-
ExecutableList
public ExecutableList(int initialCapacity)
Creates a new ExecutableList with the specified initialCapacity.- Parameters:
initialCapacity- The initial capacity for instantiating the internal List
-
ExecutableList
public ExecutableList(boolean requiresSorting)
-
ExecutableList
public ExecutableList(int initialCapacity, boolean requiresSorting)
-
ExecutableList
public ExecutableList(ExecutableList.Sorter<E> sorter)
Creates a new ExecutableList using the specified Sorter.- Parameters:
sorter- The Sorter to use; may benull
-
ExecutableList
public ExecutableList(int initialCapacity, ExecutableList.Sorter<E> sorter)Creates a new ExecutableList with the specified initialCapacity and Sorter.- Parameters:
initialCapacity- The initial capacity for instantiating the internal Listsorter- The Sorter to use; may benull
-
-
Method Detail
-
getQuerySpaces
public java.util.Set<java.io.Serializable> getQuerySpaces()
Lazily constructs the querySpaces affected by the actions in the list.- Returns:
- the querySpaces affected by the actions in this list
-
isEmpty
public boolean isEmpty()
- Returns:
- true if the list is empty.
-
remove
public E remove(int index)
Removes the entry at position index in the list.- Parameters:
index- The index of the element to remove- Returns:
- the entry that was removed
-
clear
public void clear()
Clears the list of executions.
-
removeLastN
public void removeLastN(int n)
Removes the last n entries from the list.- Parameters:
n- The number of elements to remove.
-
add
public boolean add(E executable)
Add an Executable to this list.- Parameters:
executable- the executable to add to the list- Returns:
- true if the object was added to the list
-
sort
public void sort()
Sorts the list using the natural ordering or using the Sorter if it's not null.
-
size
public int size()
- Returns:
- the current size of the list
-
get
public E get(int index)
- Parameters:
index- The index of the element to retrieve- Returns:
- The element at specified index
-
iterator
public java.util.Iterator<E> iterator()
Returns an iterator for the list. Wraps the list just in case something tries to modify it.- Specified by:
iteratorin interfacejava.lang.Iterable<E extends Executable & java.lang.Comparable & java.io.Serializable>- Returns:
- an unmodifiable iterator
-
writeExternal
public void writeExternal(java.io.ObjectOutput oos) throws java.io.IOExceptionWrite this list out to the given stream as part of serialization- Specified by:
writeExternalin interfacejava.io.Externalizable- Parameters:
oos- The stream to which to serialize our state- Throws:
java.io.IOException
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionRead this object state back in from the given stream as part of de-serialization- Specified by:
readExternalin interfacejava.io.Externalizable- Parameters:
in- The stream from which to read our serial state- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
afterDeserialize
public void afterDeserialize(SessionImplementor session)
Allow the Executables to re-associate themselves with the Session after deserialization.- Parameters:
session- The session to which to associate the Executables
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-