|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.util.AutoPopulatingList
Simple List
wrapper class that allows for elements to be
automatically populated as they are requested. This is particularly
useful for data binding to Lists
, allowing for elements
to be created and added to the List
in a "just in time" fashion.
Note: This class is not thread-safe. To create a thread-safe version,
use the Collections.synchronizedList(java.util.List
utility methods.
Inspired by LazyList
from Commons Collections.
Nested Class Summary | |
---|---|
static interface |
AutoPopulatingList.ElementFactory
Factory interface for creating elements for an index-based access data structure such as a List . |
static class |
AutoPopulatingList.ElementInstantiationException
Exception to be thrown from ElementFactory. |
Constructor Summary | |
---|---|
AutoPopulatingList(AutoPopulatingList.ElementFactory elementFactory)
Creates a new AutoPopulatingList that is backed by a standard
ArrayList and creates new elements on demand using the supplied AutoPopulatingList.ElementFactory . |
|
AutoPopulatingList(Class elementClass)
Creates a new AutoPopulatingList that is backed by a standard
ArrayList and adds new instances of the supplied element Class
to the backing List on demand. |
|
AutoPopulatingList(List backingList,
AutoPopulatingList.ElementFactory elementFactory)
Creates a new AutoPopulatingList that is backed by the supplied List
and creates new elements on demand using the supplied AutoPopulatingList.ElementFactory . |
|
AutoPopulatingList(List backingList,
Class elementClass)
Creates a new AutoPopulatingList that is backed by the supplied List
and adds new instances of the supplied element Class to the backing
List on demand. |
Method Summary | |
---|---|
void |
add(int index,
Object element)
|
boolean |
add(Object o)
|
boolean |
addAll(Collection c)
|
boolean |
addAll(int index,
Collection c)
|
void |
clear()
|
boolean |
contains(Object o)
|
boolean |
containsAll(Collection c)
|
boolean |
equals(Object o)
|
Object |
get(int index)
Get the element at the supplied index, creating it if there is no element at that index. |
int |
hashCode()
|
int |
indexOf(Object o)
|
boolean |
isEmpty()
|
Iterator |
iterator()
|
int |
lastIndexOf(Object o)
|
ListIterator |
listIterator()
|
ListIterator |
listIterator(int index)
|
Object |
remove(int index)
|
boolean |
remove(Object o)
|
boolean |
removeAll(Collection c)
|
boolean |
retainAll(Collection c)
|
Object |
set(int index,
Object element)
|
int |
size()
|
List |
subList(int fromIndex,
int toIndex)
|
Object[] |
toArray()
|
Object[] |
toArray(Object[] a)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AutoPopulatingList(Class elementClass)
AutoPopulatingList
that is backed by a standard
ArrayList
and adds new instances of the supplied element Class
to the backing List
on demand.
public AutoPopulatingList(List backingList, Class elementClass)
AutoPopulatingList
that is backed by the supplied List
and adds new instances of the supplied element Class
to the backing
List
on demand.
public AutoPopulatingList(AutoPopulatingList.ElementFactory elementFactory)
AutoPopulatingList
that is backed by a standard
ArrayList
and creates new elements on demand using the supplied AutoPopulatingList.ElementFactory
.
public AutoPopulatingList(List backingList, AutoPopulatingList.ElementFactory elementFactory)
AutoPopulatingList
that is backed by the supplied List
and creates new elements on demand using the supplied AutoPopulatingList.ElementFactory
.
Method Detail |
---|
public void add(int index, Object element)
public boolean add(Object o)
add
in interface Collection
add
in interface List
public boolean addAll(Collection c)
addAll
in interface Collection
addAll
in interface List
public boolean addAll(int index, Collection c)
public void clear()
clear
in interface Collection
clear
in interface List
public boolean contains(Object o)
contains
in interface Collection
contains
in interface List
public boolean containsAll(Collection c)
containsAll
in interface Collection
containsAll
in interface List
public boolean equals(Object o)
public Object get(int index)
public int hashCode()
public int indexOf(Object o)
public boolean isEmpty()
isEmpty
in interface Collection
isEmpty
in interface List
public Iterator iterator()
public int lastIndexOf(Object o)
lastIndexOf
in interface List
public ListIterator listIterator()
listIterator
in interface List
public ListIterator listIterator(int index)
listIterator
in interface List
public Object remove(int index)
public boolean remove(Object o)
remove
in interface Collection
remove
in interface List
public boolean removeAll(Collection c)
removeAll
in interface Collection
removeAll
in interface List
public boolean retainAll(Collection c)
retainAll
in interface Collection
retainAll
in interface List
public Object set(int index, Object element)
public int size()
size
in interface Collection
size
in interface List
public List subList(int fromIndex, int toIndex)
public Object[] toArray()
toArray
in interface Collection
toArray
in interface List
public Object[] toArray(Object[] a)
toArray
in interface Collection
toArray
in interface List
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |