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.wrap;
17  
18  
19  /**
20   * A wrapper for an indexed container that allows modification of an element at
21   * a given index. Most objects that are indexed are also "mutably indexed", if
22   * you will, but some are not. Most notably, you can't change an element at a
23   * specified index of a SortedSet because by virtue of adding something new to
24   * the set you may be changing the indices of the elements.
25   * 
26   * @author Matt Sgarlata
27   * @since Jan 16, 2005
28   */
29  public interface MutableIndexedContainer extends IndexedContainer {
30  
31  	/**
32  	 * Sets the element at the specified index. Valid indexes range between 0
33  	 * and one less than the container object's size, inclusive.
34  	 * 
35  	 * @param index
36  	 *            a number indiciating which element should be set
37  	 * @param propertyValue
38  	 *            the value to be set
39  	 * @return the element previously at the specified position
40  	 * @throws WrapperException
41  	 *             if <code>index</code> is not a valid index for this
42  	 *             container object or <br>
43  	 *             the object at the specified index could not be set for some
44  	 *             reason
45  	 */
46  	public Object set(int index, Object propertyValue) throws WrapperException;
47  
48  }