01: /*
02: * Copyright 2004-2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: package org.springframework.webflow.core.collection;
17:
18: /**
19: * An interface for accessing and modifying attributes in a backing map with
20: * string keys.
21: * <p>
22: * Implementations can optionally support {@link AttributeMapBindingListener listeners}
23: * that will be notified when they're bound in or unbound from the map.
24: *
25: * @author Keith Donald
26: */
27: public interface MutableAttributeMap extends AttributeMap {
28:
29: /**
30: * Put the attribute into this map.
31: * <p>
32: * If the attribute value is an {@link AttributeMapBindingListener} this map
33: * will publish {@link AttributeMapBindingEvent binding events} such as on
34: * "bind" and "unbind" if supported.
35: * <p>
36: * <b>Note</b>: not all <code>MutableAttributeMap</code> implementations support this.
37: * @param attributeName the attribute name
38: * @param attributeValue the attribute value
39: * @return the previous value of the attribute, or <tt>null</tt> of there
40: * was no previous value
41: */
42: public Object put(String attributeName, Object attributeValue);
43:
44: /**
45: * Put all the attributes into this map.
46: * @param attributes the attributes to put into this map
47: * @return this, to support call chaining
48: */
49: public MutableAttributeMap putAll(AttributeMap attributes);
50:
51: /**
52: * Remove an attribute from this map.
53: * @param attributeName the name of the attribute to remove
54: * @return previous value associated with specified attribute name, or
55: * <tt>null</tt> if there was no mapping for the name
56: */
57: public Object remove(String attributeName);
58:
59: /**
60: * Remove all attributes in this map.
61: * @return this, to support call chaining
62: */
63: public MutableAttributeMap clear();
64:
65: /**
66: * Replace the contents of this attribute map with the contents of the
67: * provided collection.
68: * @param attributes the attribute collection
69: * @return this, to support call chaining
70: */
71: public MutableAttributeMap replaceWith(AttributeMap attributes)
72: throws UnsupportedOperationException;
73:
74: }
|