KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > JSX > magic > MagicClass13_j9


1 /** (c) Brendan Macmillan 2001, 2002, licensed under GNU's GPL 2
2         (If your project is not GPL, then a fee is due - see license on website)
3     Website: http://www.csse.monash.edu.au/~bren/JSX
4     Website: http://freshmeat.net/projects/jsx
5     List (can read without subscribing, need to join to post):
6       http://groups.yahoo.com/group/JSX-ideas/messages
7         Commercial licensing enquiries only:
8             bren@objectlight.com */

9
10 // NB: this is initially a straight copy of MagicClass13... could subclass,
11
// but efficiency concerns.
12

13 package JSX.magic;
14 import java.lang.reflect.*;
15 import java.io.*;
16
17 class MagicClass13_j9 extends MagicClass13 {
18     MagicClass13_j9() {
19         super();
20         try {
21             // field is static (inherited from MagicClassI - interface class)
22
oscNameField = ObjectStreamClass.class.getDeclaredField(
23                 "className"); //OTI's j9 uses this instead of "name"
24
oscNameField.setAccessible(true);
25             osc = (ObjectStreamClass) newInstance(ObjectStreamClass.class);
26         } catch (NoSuchFieldException JavaDoc noField) {
27             throw new InternalError JavaDoc(noField.toString());
28         } catch (NotSerializableException e) { // Serializable check in newInstance
29
e.printStackTrace();
30         }
31     }
32 }
33
Popular Tags