View Javadoc

1   /*
2    * Copyright 2004-2005 the original author or authors.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5    * use this file except in compliance with the License. You may obtain a copy of
6    * the License at
7    * 
8    * http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations under
14   * the License.
15   */
16  package net.sf.morph.reflect;
17  
18  /**
19   * A reflector for an indexed structure that allows modification of an element
20   * at a given index.  Most objects that are indexed are also "mutably indexed",
21   * if you will, but some are not.  Most notably, you can't change an
22   * element at a specified index of a SortedSet because by virtue of adding
23   * something new to the set you may be changing the indices of the elements. 
24   * 
25   * @author Matt Sgarlata
26   * @since Nov 26, 2004
27   */
28  public interface MutableIndexedContainerReflector extends IndexedContainerReflector {
29  	
30  	/**
31  	 * Sets the element at the specified index. Valid indexes range between 0
32  	 * and one less than the container object's size, inclusive.
33  	 * 
34  	 * @param container
35  	 *            the container object
36  	 * @param index
37  	 *            a number indiciating which element should be set
38  	 * @param propertyValue
39  	 *            the value to be set
40  	 * @return the element previously at the specified position
41  	 * @throws ReflectionException
42  	 *             if <code>container</code> is null or <br>
43  	 *             <code>index</code> is not a valid index for the given
44  	 *             container object or <br>
45  	 *             the object at the specified index could not be set for some
46  	 *             reason
47  	 */
48  	public Object set(Object container, int index, Object propertyValue)
49  		throws ReflectionException;
50  	
51  }