|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pivot.sql.ResultList
public class ResultList
Implementation of the List
interface that is backed by a
instance of ResultSet
.
Note that this list is not suitable for random access and can only be navigated via an iterator.
Nested Class Summary | |
---|---|
static class |
ResultList.Field
Class that maps a result set column to a map key/value pair. |
Nested classes/interfaces inherited from interface org.apache.pivot.collections.List |
---|
List.ItemIterator<T>, List.ListListenerList<T> |
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Sequence |
---|
Sequence.Tree<T> |
Constructor Summary | |
---|---|
ResultList(ResultSet resultSet)
|
Method Summary | |
---|---|
int |
add(Map<String,Object> item)
Adds an item to the list. |
void |
clear()
Removes all elements from the collection. |
Map<String,Object> |
get(int index)
Retrieves the item at the given index. |
Comparator<Map<String,Object>> |
getComparator()
Returns the collection's sort order. |
Sequence<ResultList.Field> |
getFields()
|
boolean |
getIncludeNullValues()
|
int |
getLength()
Returns the length of the list. |
ListenerList<ListListener<Map<String,Object>>> |
getListListeners()
Returns the list listener list. |
ResultSet |
getResultSet()
|
int |
indexOf(Map<String,Object> item)
Returns the index of an item in the sequence. |
void |
insert(Map<String,Object> item,
int index)
Inserts an item into the list. |
boolean |
isEmpty()
Tests the emptiness of the collection. |
Iterator<Map<String,Object>> |
iterator()
|
Sequence<Map<String,Object>> |
remove(int index,
int count)
Removes one or more items from the sequence. |
int |
remove(Map<String,Object> item)
Removes the first occurrence of the given item from the sequence. |
void |
setComparator(Comparator<Map<String,Object>> comparator)
Sets the collection's sort order, re-ordering the collection's contents and ensuring that new entries preserve the sort order. |
void |
setFields(ResultList.Field... fields)
|
void |
setFields(Sequence<ResultList.Field> fields)
|
void |
setIncludeNullValues(boolean includeNullValues)
|
Map<String,Object> |
update(int index,
Map<String,Object> item)
Updates the item at the given index. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ResultList(ResultSet resultSet)
Method Detail |
---|
public ResultSet getResultSet()
public Sequence<ResultList.Field> getFields()
public void setFields(Sequence<ResultList.Field> fields)
public void setFields(ResultList.Field... fields)
public boolean getIncludeNullValues()
public void setIncludeNullValues(boolean includeNullValues)
public int add(Map<String,Object> item)
List
add
in interface List<Map<String,Object>>
add
in interface Sequence<Map<String,Object>>
item
- The item to be added to the sequence.
ListListener.itemInserted(List, int)
public void insert(Map<String,Object> item, int index)
List
insert
in interface List<Map<String,Object>>
insert
in interface Sequence<Map<String,Object>>
item
- The item to be added to the list.index
- The index at which the item should be inserted. Must be a value between
0 and getLength().ListListener.itemInserted(List, int)
public Map<String,Object> update(int index, Map<String,Object> item)
List
update
in interface List<Map<String,Object>>
update
in interface Sequence<Map<String,Object>>
index
- The index of the item to update.item
- The item that will replace any existing value at the given index.
ListListener.itemUpdated(List, int, Object)
public int remove(Map<String,Object> item)
Sequence
remove
in interface Sequence<Map<String,Object>>
item
- The item to remove.
Sequence.remove(int, int)
public Sequence<Map<String,Object>> remove(int index, int count)
Sequence
remove
in interface List<Map<String,Object>>
remove
in interface Sequence<Map<String,Object>>
index
- The starting index to remove.count
- The number of items to remove, beginning with index.
ListListener.itemsRemoved(List, int, Sequence)
public void clear()
Collection
clear
in interface Collection<Map<String,Object>>
clear
in interface List<Map<String,Object>>
ListListener.itemsRemoved(List, int, Sequence)
public Map<String,Object> get(int index)
Sequence
get
in interface Sequence<Map<String,Object>>
index
- The index of the item to retrieve.public int indexOf(Map<String,Object> item)
Sequence
indexOf
in interface Sequence<Map<String,Object>>
item
- The item to locate.
public boolean isEmpty()
Collection
isEmpty
in interface Collection<Map<String,Object>>
public int getLength()
List
getLength
in interface List<Map<String,Object>>
getLength
in interface Sequence<Map<String,Object>>
public Comparator<Map<String,Object>> getComparator()
Collection
getComparator
in interface Collection<Map<String,Object>>
Collection.setComparator(Comparator)
public void setComparator(Comparator<Map<String,Object>> comparator)
Collection
Calling this method more than once with the same comparator will re-sort the collection.
setComparator
in interface Collection<Map<String,Object>>
setComparator
in interface List<Map<String,Object>>
comparator
- The comparator used to order elements in the collection, or null if the
collection is unsorted.ListListener.comparatorChanged(List, Comparator)
public Iterator<Map<String,Object>> iterator()
iterator
in interface Iterable<Map<String,Object>>
public ListenerList<ListListener<Map<String,Object>>> getListListeners()
List
getListListeners
in interface List<Map<String,Object>>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |