Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||
EOKeyValueCoding |
|
| 1.0;1 |
1 | /* |
|
2 | Wotonomy: OpenStep design patterns for pure Java applications. |
|
3 | Copyright (C) 2001 Intersect Software Corporation |
|
4 | ||
5 | This library is free software; you can redistribute it and/or |
|
6 | modify it under the terms of the GNU Lesser General Public |
|
7 | License as published by the Free Software Foundation; either |
|
8 | version 2.1 of the License, or (at your option) any later version. |
|
9 | ||
10 | This library is distributed in the hope that it will be useful, |
|
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 | Lesser General Public License for more details. |
|
14 | ||
15 | You should have received a copy of the GNU Lesser General Public |
|
16 | License along with this library; if not, see http://www.gnu.org |
|
17 | */ |
|
18 | ||
19 | package net.wotonomy.control; |
|
20 | ||
21 | import net.wotonomy.foundation.NSKeyValueCoding; |
|
22 | ||
23 | /** |
|
24 | * EOKeyValueCoding defines an interface for classes that |
|
25 | * need to have more control over the wotonomy's property |
|
26 | * introspection facilities. <br><br> |
|
27 | * |
|
28 | * On an object that implements this interface, wotonomy |
|
29 | * will call these methods, and otherwise use the static |
|
30 | * methods on EOKeyValueCodingSupport. <br><br> |
|
31 | * |
|
32 | * EOKeyValueCodingSupport implements the default behaviors |
|
33 | * for each of these methods, so classes implementing this |
|
34 | * interface can call those methods to acheive the same |
|
35 | * behavior. <br><br> |
|
36 | * |
|
37 | * valueForKey and takeValueForKey are called in response |
|
38 | * to user actions, like viewing an object or updating its |
|
39 | * value in a user interface. These should call the public |
|
40 | * getter and setter methods on the object itself and the |
|
41 | * operations should be subject to validation. <br><br> |
|
42 | * |
|
43 | * storedValueForKey and takeStoredValueForKey are called |
|
44 | * in response to wotonomy actions, like snapshotting, |
|
45 | * faulting, commits, and reverts. These operations should |
|
46 | * bypass the public methods and directly modify the internal |
|
47 | * state of the object without validation. |
|
48 | * |
|
49 | * @author michael@mpowers.net |
|
50 | * @author $Author: cgruber $ |
|
51 | * @version $Revision: 893 $ |
|
52 | */ |
|
53 | public interface EOKeyValueCoding extends NSKeyValueCoding |
|
54 | { |
|
55 | /** |
|
56 | * Returns the value for the specified property. |
|
57 | * If the property does not exist, this method should |
|
58 | * call handleQueryWithUnboundKey. |
|
59 | */ |
|
60 | Object valueForKey( String aKey ); |
|
61 | ||
62 | /** |
|
63 | * Sets the property to the specified value. |
|
64 | * If the property does not exist, this method should |
|
65 | * call handleTakeValueForUnboundKey. |
|
66 | * If the property is of a type that cannot allow |
|
67 | * null (e.g. primitive types) and aValue is null, |
|
68 | * this method should call unableToSetNullForKey. |
|
69 | */ |
|
70 | void takeValueForKey( Object aValue, String aKey ); |
|
71 | ||
72 | /** |
|
73 | * Returns the value for the private field that |
|
74 | * corresponds to the specified property. |
|
75 | */ |
|
76 | Object storedValueForKey( String aKey ); |
|
77 | ||
78 | /** |
|
79 | * Sets the the private field that corresponds to the |
|
80 | * specified property to the specified value. |
|
81 | */ |
|
82 | void takeStoredValueForKey( Object aValue, String aKey ); |
|
83 | ||
84 | /** |
|
85 | * Called by valueForKey when the specified key is |
|
86 | * not found on this object. Implementing classes |
|
87 | * should handle the specified value or otherwise |
|
88 | * throw an exception. |
|
89 | */ |
|
90 | Object handleQueryWithUnboundKey( String aKey ); |
|
91 | ||
92 | /** |
|
93 | * Called by takeValueForKey when the specified key |
|
94 | * is not found on this object. Implementing classes |
|
95 | * should handle the specified value or otherwise |
|
96 | * throw an exception. |
|
97 | */ |
|
98 | void handleTakeValueForUnboundKey( Object aValue, String aKey ); |
|
99 | ||
100 | /** |
|
101 | * Called by takeValueForKey when the type of the |
|
102 | * specified key is not allowed to be null, as is |
|
103 | * the case with primitive types. Implementing |
|
104 | * classes should handle this case appropriately |
|
105 | * or otherwise throw an exception. |
|
106 | */ |
|
107 | void unableToSetNullForKey( String aKey ); |
|
108 | ||
109 | } |
|
110 | ||
111 | /* |
|
112 | * $Log$ |
|
113 | * Revision 1.1 2006/02/16 13:19:57 cgruber |
|
114 | * Check in all sources in eclipse-friendly maven-enabled packages. |
|
115 | * |
|
116 | * Revision 1.3 2003/01/16 22:47:30 mpowers |
|
117 | * Compatibility changes to support compiling woextensions source. |
|
118 | * (34 out of 56 classes compile!) |
|
119 | * |
|
120 | * Revision 1.2 2001/03/28 16:12:30 mpowers |
|
121 | * Documented interface. |
|
122 | * |
|
123 | * Revision 1.1 2001/03/27 23:25:05 mpowers |
|
124 | * Contributing interface, no docs yet. |
|
125 | * |
|
126 | * |
|
127 | */ |
|
128 | ||
129 |