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.Externalizable
Specialized 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 interface
ExecutableList.Sorter<E extends Executable>
Provides a sorting interface for ExecutableList.
-
Field Summary
Fields Modifier and Type Field Description static int
INIT_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 boolean
add(E executable)
Add an Executable to this list.void
afterDeserialize(SessionImplementor session)
Allow the Executables to re-associate themselves with the Session after deserialization.void
clear()
Clears the list of executions.E
get(int index)
java.util.Set<java.io.Serializable>
getQuerySpaces()
Lazily constructs the querySpaces affected by the actions in the list.boolean
isEmpty()
java.util.Iterator<E>
iterator()
Returns an iterator for the list.void
readExternal(java.io.ObjectInput in)
Read this object state back in from the given stream as part of de-serializationE
remove(int index)
Removes the entry at position index in the list.void
removeLastN(int n)
Removes the last n entries from the list.int
size()
void
sort()
Sorts the list using the natural ordering or using the Sorter if it's not null.java.lang.String
toString()
void
writeExternal(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:
iterator
in 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.IOException
Write this list out to the given stream as part of serialization- Specified by:
writeExternal
in 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.ClassNotFoundException
Read this object state back in from the given stream as part of de-serialization- Specified by:
readExternal
in interfacejava.io.Externalizable
- Parameters:
in
- The stream from which to read our serial state- Throws:
java.io.IOException
java.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:
toString
in classjava.lang.Object
-
-