KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > web > AttributeHolder


1 // Copyright 2005 The Apache Software Foundation
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15 package org.apache.tapestry.web;
16
17 import java.util.List JavaDoc;
18
19 /**
20  * Interface for objects that can hold attributes. Attributes are objects that are stored and
21  * retrieved using unique string names. There may be constraints on when attributes can be accessed
22  * (for example, {@link org.apache.tapestry.web.WebSession}attributes should not be
23  * changed once the response is committed).
24  *
25  * @author Howard M. Lewis Ship
26  * @since 4.0
27  */

28 public interface AttributeHolder
29 {
30     /**
31      * Returns a list of all known attributes in ascending alphabetical order. May be empty (but
32      * won't be null).
33      *
34      * @returns Unmodifiable list of string attribute names.
35      */

36
37     public List JavaDoc getAttributeNames();
38
39     /**
40      * Returns the named object, or null if no attribute has been stored with the given name.
41      */

42
43     public Object JavaDoc getAttribute(String JavaDoc name);
44
45     /**
46      * Updates the attribute, replacing (or removing) its value. For certain implementations, the
47      * attribute may need to be serializable (for example, a {@link WebSession}
48      *  attribute in a clustered application).
49      *
50      * @param name
51      * the name of the attribute to update
52      * @param attribute
53      * the new value for the attribute, or null to delete the attribute entirely.
54      */

55
56     public void setAttribute(String JavaDoc name, Object JavaDoc attribute);
57 }
Popular Tags