KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > lang > mutable > Mutable


1 /*
2  * Copyright 2002-2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of 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,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.commons.lang.mutable;
18
19 /**
20  * Provides mutable access to a value.
21  * <p>
22  * <code>Mutable</code> is used as a generic interface to the implementations in this package.
23  * <p>
24  * A typical use case would be to enable a primitive or string to be passed to a method and allow that method to
25  * effectively change the value of the primitive/string. Another use case is to store a frequently changing primitive in
26  * a collection (for example a total in a map) without needing to create new Integer/Long wrapper objects.
27  *
28  * @author Matthew Hawthorne
29  * @since 2.1
30  * @version $Id: Mutable.java 161243 2005-04-14 04:30:28Z ggregory $
31  */

32 public interface Mutable {
33
34     /**
35      * Gets the value of this mutable.
36      *
37      * @return the stored value
38      */

39     Object JavaDoc getValue();
40
41     /**
42      * Sets the value of this mutable.
43      *
44      * @param value
45      * the value to store
46      * @throws NullPointerException
47      * if the object is null and null is invalid
48      * @throws ClassCastException
49      * if the type is invalid
50      */

51     void setValue(Object JavaDoc value);
52
53 }
54
Popular Tags