net.sourceforge.stripes.util.bean
Class ListPropertyAccessor
java.lang.Object
net.sourceforge.stripes.util.bean.ListPropertyAccessor
- All Implemented Interfaces:
- PropertyAccessor<List<?>>
public class ListPropertyAccessor
- extends Object
- implements PropertyAccessor<List<?>>
Implementation of PropertyAccessor
for interacting with Lists. Automatically
expands the list to make the supplied list index valid for set operations, and suppresses
IndexOutOfBoundsExceptions during get operations.
- Since:
- Stripes 1.4
- Author:
- Tim Fennell
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ListPropertyAccessor
public ListPropertyAccessor()
getValue
public Object getValue(NodeEvaluation evaluation,
List<?> list)
- Fetches the value stored at the index specified by the current node. If the index is
out of bounds, will return null.
- Specified by:
getValue
in interface PropertyAccessor<List<?>>
- Parameters:
evaluation
- the current node evaluationlist
- the target list
- Returns:
- the corresponding item in the list, or null if the list is not long enough
setValue
public void setValue(NodeEvaluation evaluation,
List list,
Object value)
- Sets the value at the index specified by the current node to the supplied value. If
the list is not long enough it is expanded (filling with nulls) until it is large
enough to accommodate the supplied index.
- Specified by:
setValue
in interface PropertyAccessor<List<?>>
- Parameters:
evaluation
- the current node evaluationlist
- the target listvalue
- the value to be stored at the specified index
? Copyright 2005-2006, Stripes Development Team.