net.sf.morph.reflect
Interface IndexedContainerReflector

All Superinterfaces:
net.sf.composite.Component, ContainerReflector, Reflector, SizableReflector
All Known Subinterfaces:
MutableIndexedContainerReflector
All Known Implementing Classes:
ArrayReflector, ListReflector, ServletRequestReflector, SimpleDelegatingReflector, SortedSetReflector, StubbornDelegatingReflector

public interface IndexedContainerReflector
extends ContainerReflector, SizableReflector

A reflector for 'container-like' structures that have a logical ordering which can be used to retrieve elements at a specific index within the structure. Lists, SortedSets, and arrays are good examples of indexed structures. Note that some indexed structures will have O(1) methods for retrieving objects at a given index (ArrayList, TreeSet, array) and others will have O(n) methods for retrieving objects at a given index (LinkedList).

Since:
Nov 14, 2004
Author:
Matt Sgarlata

Field Summary
 
Fields inherited from interface net.sf.morph.reflect.SizableReflector
IMPLICIT_PROPERTY_SIZE
 
Method Summary
 java.lang.Object get(java.lang.Object container, int index)
          Gets the element at the specified index.
 
Methods inherited from interface net.sf.morph.reflect.ContainerReflector
getContainedType, getIterator
 
Methods inherited from interface net.sf.morph.reflect.Reflector
getReflectableClasses, getWrapper
 
Methods inherited from interface net.sf.morph.reflect.SizableReflector
getSize
 
Methods inherited from interface net.sf.morph.reflect.Reflector
getReflectableClasses, getWrapper
 

Method Detail

get

java.lang.Object get(java.lang.Object container,
                     int index)
                     throws ReflectionException
Gets the element at the specified index. Valid indexes range between 0 and one less than the container object's size, inclusive.

Parameters:
container - the container object
index - a number indiciating which element should be retrieved
Returns:
the object at the specified index
Throws:
ReflectionException - if container is null or
index is not a valid index for the given container object or
the object at the specified index could not be retrieved for some reason


Copyright © 2004-2008.