01: /**
02: *
03: */package clime.messadmin.utils;
04:
05: import java.io.Serializable;
06: import java.util.Map;
07:
08: /**
09: * An Entry maintaining an immutable key and value. This class
10: * does not support method <tt>setValue</tt>. This class may be
11: * convenient in methods that return thread-safe snapshots of
12: * key-value mappings.
13: *
14: * @since 1.6
15: * @author Cédrik LIME
16: */
17: public class SimpleImmutableEntry extends SimpleEntry implements
18: Map.Entry, Serializable {
19: /**
20: * Creates an entry representing a mapping from the specified
21: * key to the specified value.
22: *
23: * @param key the key represented by this entry
24: * @param value the value represented by this entry
25: */
26: public SimpleImmutableEntry(Object key, Object value) {
27: super (key, value);
28: }
29:
30: /**
31: * Creates an entry representing the same mapping as the
32: * specified entry.
33: *
34: * @param entry the entry to copy
35: */
36: public SimpleImmutableEntry(Map.Entry entry) {
37: super (entry);
38: }
39:
40: /**
41: * Replaces the value corresponding to this entry with the specified
42: * value (optional operation). This implementation simply throws
43: * <tt>UnsupportedOperationException</tt>, as this class implements
44: * an <i>immutable</i> map entry.
45: *
46: * @param value new value to be stored in this entry
47: * @return (Does not return)
48: * @throws UnsupportedOperationException always
49: */
50: public Object setValue(Object value) {
51: throw new UnsupportedOperationException();
52: }
53:
54: }
|