Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/progeeks/meta/ListMutator.java


1   /*
2    * $Id: ListMutator.java,v 1.2 2003/01/09 07:45:24 pspeed Exp $
3    *
4    * Copyright (c) 2001-2002, Paul Speed
5    * All rights reserved.
6    *
7    * Redistribution and use in source and binary forms, with or without
8    * modification, are permitted provided that the following conditions
9    * are met:
10   *
11   * 1) Redistributions of source code must retain the above copyright notice,
12   *    this list of conditions and the following disclaimer.
13   * 2) Redistributions in binary form must reproduce the above copyright
14   *    notice, this list of conditions and the following disclaimer in the
15   *    documentation and/or other materials provided with the distribution.
16   * 3) Neither the names "Progeeks", "Meta-JB", nor the names of its contributors
17   *    may be used to endorse or promote products derived from this software
18   *    without specific prior written permission.
19   *
20   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30   * POSSIBILITY OF SUCH DAMAGE.
31   */
32  
33  package org.progeeks.meta;
34  
35  import java.beans.*;
36  import java.util.*;
37  
38  /**
39   *  Extends PropertyMutator to provide access to the members
40   *  of a multi-valued property value.  This allows the mutator
41   *  to properly manage list change notifications even if the
42   *  actual storage object does not.  For example, standard java.util.List
43   *  based properties can't be expected to manage the complexities of
44   *  element change notification, insertions, etc..  The mutator wraps
45   *  this support around the real value.
46   *
47   *  @version   $Revision: 1.2 $
48   *  @author    Paul Speed
49   */
50  public interface ListMutator extends PropertyMutator
51  {
52      // Note: eventually this interface may just extend
53      //       the java.util.List interface as well which is
54      //       why the method signatures look similar.
55  
56      /**
57       *  Returns the number of elements in the list value.
58       */
59      public int size();
60  
61      /**
62       *  Adds the object to the list value, returning true
63       *  if the contents of the list actually changed as a result
64       *  of the operation.
65       *
66       *  @throws UnsupportedOperationException if the list value does
67       *          not support adds.
68       */
69      public boolean add( Object object );
70  
71      /**
72       *  Adds the object to the list value at the specified index.
73       *
74       *  @throws UnsupportedOperationException if the list value does
75       *          not support adds.
76       */
77      public void add( int index, Object object );
78  
79      /**
80       *  Returns the object at the specified location.
81       */
82      public Object get( int index );
83  
84      /**
85       *  Returns an iterator over the elements in this list value.
86       */
87      public Iterator iterator();
88  
89      /**
90       *  Replaces the value at the specified location.
91       *
92       *  @throws UnsupportedOperationException if the list value does
93       *          not support replacing elements.
94       */
95      public Object set( int index, Object object );
96  
97      /**
98       *  Removes the object at the specified location and returns
99       *  the locations value prior to removal.
100      *
101      *  @throws UnsupportedOperationException if the list value does
102      *          not support removes.
103      */
104     public Object remove( int index );
105 
106     /**
107      *  Removes the specified object from the list value, returning true
108      *  if the list contents were modified as a result of the action.
109      *
110      *  @throws UnsupportedOperationException if the list value does
111      *          not support removes.
112      */
113     public boolean remove( Object object );
114 
115     /**
116      *  Clears the contents of the list value.
117      *
118      *  @throws UnsupportedOperationException if the list value does
119      *          not support being cleared.
120      */
121     public void clear();
122 }