Class ListChangeEvent<T>
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.model.ListChangeEvent<T>
-
- All Implemented Interfaces:
IListChangeEvent<T>
public class ListChangeEvent<T> extends java.lang.Object implements IListChangeEvent<T>
The default implementation ofIListChangeListenerwhere the generics is the type of the items.- Version:
- 2.4
- Author:
- Pascal Filion
- Since:
- 2.4
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.persistence.jpa.jpql.tools.model.IListChangeEvent
IListChangeEvent.EventType
-
-
Constructor Summary
Constructors Constructor Description ListChangeEvent(StateObject source, java.util.List<? extends T> list, IListChangeEvent.EventType eventType, java.lang.String listName, java.util.List<? extends T> items, int startIndex, int endIndex)Creates a newListChangeEvent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetEndIndex()Returns the index of where the change occurred in the list.IListChangeEvent.EventTypegetEventType()Returns the type of change that occurred in the list.java.util.List<T>getList()Returns a copy of the actual list after the change has happened.java.lang.StringgetListName()Returns the name describing the list.<S extends ListHolderStateObject<? extends T>>
SgetSource()Returns the source where the modification occurred and that fired the event.intgetStartIndex()Returns the index of where the change occurred in the list.ListIterable<T>items()Returns the list of items that have caused the original list to change.intitemsSize()Returns the number of items that caused the original list to change.
-
-
-
Constructor Detail
-
ListChangeEvent
public ListChangeEvent(StateObject source, java.util.List<? extends T> list, IListChangeEvent.EventType eventType, java.lang.String listName, java.util.List<? extends T> items, int startIndex, int endIndex)
Creates a newListChangeEvent.- Parameters:
source- The source where the modification occurred and that fired the event
-
-
Method Detail
-
getEndIndex
public int getEndIndex()
Returns the index of where the change occurred in the list.- Specified by:
getEndIndexin interfaceIListChangeEvent<T>- Returns:
- The index of where the change occurred in the list
-
getEventType
public IListChangeEvent.EventType getEventType()
Returns the type of change that occurred in the list.- Specified by:
getEventTypein interfaceIListChangeEvent<T>- Returns:
- One of the possible
typesof changes
-
getList
public java.util.List<T> getList()
Returns a copy of the actual list after the change has happened.- Specified by:
getListin interfaceIListChangeEvent<T>- Returns:
- The copy of the list that got changed
-
getListName
public java.lang.String getListName()
Returns the name describing the list.- Specified by:
getListNamein interfaceIListChangeEvent<T>- Returns:
- The name of the list for which
IListChangeListenershave been registered with the source to be notified upon changes
-
getSource
public <S extends ListHolderStateObject<? extends T>> S getSource()
Returns the source where the modification occurred and that fired the event.- Specified by:
getSourcein interfaceIListChangeEvent<T>- Type Parameters:
S- The type of the source owning the list- Returns:
- The source of the event
-
getStartIndex
public int getStartIndex()
Returns the index of where the change occurred in the list.- Specified by:
getStartIndexin interfaceIListChangeEvent<T>- Returns:
- The index of where the change occurred in the list
-
items
public ListIterable<T> items()
Returns the list of items that have caused the original list to change. Depending on the even type:- items that have been added (
IListChangeEvent.EventType.ADDED); - items that have been removed (
IListChangeEvent.EventType.REMOVED); - items that have been moved up (
IListChangeEvent.EventType.MOVED_UP); - items that have been down (
IListChangeEvent.EventType.MOVED_DOWN); - a single item that has been replaced (
IListChangeEvent.EventType.REPLACED); - the items that were in the list before it got totally changed (
IListChangeEvent.EventType.CHANGED).
- Specified by:
itemsin interfaceIListChangeEvent<T>- Returns:
- The list of items associated with the
IListChangeEvent.EventType
- items that have been added (
-
itemsSize
public int itemsSize()
Returns the number of items that caused the original list to change.- Specified by:
itemsSizein interfaceIListChangeEvent<T>- Returns:
- The count of items triggering this event
-
-