1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
|
/*
Wotonomy: OpenStep design patterns for pure Java applications.
Copyright (C) 2002 Israfil consulting Services Corporation
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see http://www.gnu.org
$Id: NSCoding.java 892 2006-02-16 12:47:16Z cgruber $
*/
package net.wotonomy.foundation;
import java.math.BigInteger;
/**
* A helper interface supporting the NSCoder APIs. At present it very confusing
* to me how this even works from a structural perspective, but to be consistent
* with WebObjects APIs, this will have to be properly implemented.
*
* @author cgruber@israfil.net
* @author $Author: cgruber $
* @version $Revision: 892 $
*/
public interface NSCoding {
/** Not yet implemented */
public static class _BigDecimalSupport extends _BigIntegerSupport {
/** Not yet implemented */
public void encodeWithCoder(Object obj, NSCoder nscoder) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
/** Not yet implemented */
public Object decodeObject(NSCoder nscoder) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
/** Not yet implemented */
public _BigDecimalSupport() {
throw new UnsupportedOperationException("Not Yet Implemented");
}
}
/** Not yet implemented */
public static class _BigIntegerSupport extends Support {
/** Not yet implemented */
public void encodeWithCoder(Object obj, NSCoder nscoder) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
/** Not yet implemented */
public Object decodeObject(NSCoder nscoder) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
/** Not yet implemented */
protected static void _encodeBigInteger(NSCoder nscoder, BigInteger biginteger) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
/** Not yet implemented */
protected static BigInteger _decodeBigInteger(NSCoder nscoder, int i) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
/** Not yet implemented */
public _BigIntegerSupport() {
throw new UnsupportedOperationException("Not Yet Implemented");
}
}
/** Not yet implemented */
public static class _DoubleSupport extends _NumberSupport {
/** Not yet implemented */
public void encodeWithCoder(Object obj, NSCoder nscoder) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
/** Not yet implemented */
public _DoubleSupport() {
throw new UnsupportedOperationException("Not Yet Implemented");
}
}
/** Not yet implemented */
public static class _FloatSupport extends _NumberSupport {
/** Not yet implemented */
public void encodeWithCoder(Object obj, NSCoder nscoder) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
/** Not yet implemented */
public _FloatSupport() {
throw new UnsupportedOperationException("Not Yet Implemented");
}
}
/** Not yet implemented */
public static class _LongSupport extends _NumberSupport {
/** Not yet implemented */
public void encodeWithCoder(Object obj, NSCoder nscoder) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
/** Not yet implemented */
public _LongSupport() {
throw new UnsupportedOperationException("Not Yet Implemented");
}
}
/** Not yet implemented */
public static class _IntegerSupport extends _NumberSupport {
/** Not yet implemented */
public void encodeWithCoder(Object obj, NSCoder nscoder) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
/** Not yet implemented */
public _IntegerSupport() {
throw new UnsupportedOperationException("Not Yet Implemented");
}
}
/** Not yet implemented */
public static class _ShortSupport extends _NumberSupport {
/** Not yet implemented */
public void encodeWithCoder(Object obj, NSCoder nscoder) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
/** Not yet implemented */
public _ShortSupport() {
throw new UnsupportedOperationException("Not Yet Implemented");
}
}
/** Not yet implemented */
public static class _ByteSupport extends _NumberSupport {
/** Not yet implemented */
public void encodeWithCoder(Object obj, NSCoder nscoder) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
/** Not yet implemented */
public _ByteSupport() {
throw new UnsupportedOperationException("Not Yet Implemented");
}
}
/** Not yet implemented */
public static class _NumberSupport extends Support {
/** Not yet implemented */
public Class classForCoder(Object obj) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
/** Not yet implemented */
public void encodeWithCoder(Object obj, NSCoder nscoder) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
/** Not yet implemented */
public Object decodeObject(NSCoder nscoder) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
/** Not yet implemented */
public _NumberSupport() {
throw new UnsupportedOperationException("Not Yet Implemented");
}
}
/** Not yet implemented */
public static class _CharacterSupport extends Support {
/** Not yet implemented */
public void encodeWithCoder(Object obj, NSCoder nscoder) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
/** Not yet implemented */
public Object decodeObject(NSCoder nscoder) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
/** Not yet implemented */
public _CharacterSupport() {
throw new UnsupportedOperationException("Not Yet Implemented");
}
}
/** Not yet implemented */
public static class _DateSupport extends Support {
/** Not yet implemented */
public void encodeWithCoder(Object obj, NSCoder nscoder) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
/** Not yet implemented */
public Object decodeObject(NSCoder nscoder) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
/** Not yet implemented */
public _DateSupport() {
throw new UnsupportedOperationException("Not Yet Implemented");
}
}
/** Not yet implemented */
public static class _StringSupport extends Support {
/** Not yet implemented */
public void encodeWithCoder(Object obj, NSCoder nscoder) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
/** Not yet implemented */
public Object decodeObject(NSCoder nscoder) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
/** Not yet implemented */
public _StringSupport() {
throw new UnsupportedOperationException("Not Yet Implemented");
}
}
/** Not yet implemented */
public static class _BooleanSupport extends Support {
/** Not yet implemented */
public void encodeWithCoder(Object obj, NSCoder nscoder) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
/** Not yet implemented */
public Object decodeObject(NSCoder nscoder) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
/** Not yet implemented */
public _BooleanSupport() {
throw new UnsupportedOperationException("Not Yet Implemented");
}
}
/** Helper class for NSCoding. */
public static abstract class Support {
private static NSMutableDictionary classSupportMap = new NSMutableDictionary(16);
public static Support supportForClass(Class aClass) {
Support support = null;
Class realClass = aClass;
while (support == null && realClass != null) {
support = (Support) classSupportMap.objectForKey(realClass);
if (support == null)
realClass.getSuperclass();
// Cache if we had to look to a superclass.
else if (aClass != realClass)
classSupportMap.setObjectForKey(support, aClass);
}
return support;
}
public static void setSupportForClass(Support support, Class class1) {
classSupportMap.setObjectForKey(support, class1);
}
/**
* Return the class of a given object. It boggles the mind as to why this is not
* a static, but in the original, it's not. <sigh>
*/
public Class classForCoder(Object obj) {
return obj.getClass();
}
public abstract void encodeWithCoder(Object obj, NSCoder nscoder);
public abstract Object decodeObject(NSCoder nscoder);
protected static void _encodeUTF8(String s, NSCoder nscoder) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
protected static String _decodeUTF8(NSCoder nscoder) {
throw new UnsupportedOperationException("Not Yet Implemented");
}
static {
setSupportForClass(new _StringSupport(), java.lang.String.class);
setSupportForClass(new _BooleanSupport(), java.lang.Boolean.class);
setSupportForClass(new _NumberSupport(), null);
setSupportForClass(new _ByteSupport(), java.lang.Byte.class);
setSupportForClass(new _ShortSupport(), java.lang.Short.class);
setSupportForClass(new _IntegerSupport(), java.lang.Integer.class);
setSupportForClass(new _LongSupport(), java.lang.Long.class);
setSupportForClass(new _FloatSupport(), java.lang.Float.class);
setSupportForClass(new _DoubleSupport(), java.lang.Double.class);
setSupportForClass(new _BigIntegerSupport(), java.math.BigInteger.class);
setSupportForClass(new _BigDecimalSupport(), java.math.BigDecimal.class);
setSupportForClass(new _DateSupport(), java.util.Date.class);
setSupportForClass(new _CharacterSupport(), java.lang.Character.class);
}
public Support() {
}
}
// CEG: I'm not sure why these are here, since NSCoding is an interface.
// It doesn't seem to even be used anywhere.
// CEG: I'm not even sure why this compiles!!
// public abstract Class classForCoder();
// CEG: I'm not sure why these are here, since NSCoding is an interface.
// It doesn't seem to even be used anywhere.
// CEG: I'm not even sure why this compiles!!
// public abstract void encodeWithCoder(NSCoder nscoder);
}
/*
* $Log$ Revision 1.1 2006/02/16 12:47:16 cgruber Check in all sources in
* eclipse-friendly maven-enabled packages.
*
* Revision 1.2 2003/08/06 23:07:52 chochos general code cleanup (mostly,
* removing unused imports)
*
* Revision 1.1 2002/07/14 21:56:16 mpowers Contributions from cgruber.
*
* Revision 1.2 2002/06/25 19:03:02 cgruber Internal documentation fixes.
*
* Revision 1.1 2002/06/25 07:52:56 cgruber Add quite a few abstract classes,
* interfaces, and classes. All API consistent with WebObjects, but with no
* implementation, nor any private or package access members from the original.
*
*/
|