author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 28 Sep 2011 20:07:49 +0100 | |
branch | jv |
changeset 17865 | 598963c6ff8e |
parent 17846 | 24edc476ac18 |
child 17869 | 9610c6c94e71 |
permissions | -rw-r--r-- |
5271 | 1 |
" |
2 |
COPYRIGHT (c) 1999 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
11112 | 12 |
"{ Package: 'stx:libbasic' }" |
5271 | 13 |
|
4509 | 14 |
Metaclass subclass:#AutoloadMetaclass |
15 |
instanceVariableNames:'' |
|
16 |
classVariableNames:'' |
|
17 |
poolDictionaries:'' |
|
18 |
category:'Kernel-Classes' |
|
19 |
! |
|
20 |
||
21 |
!AutoloadMetaclass class methodsFor:'documentation'! |
|
22 |
||
5271 | 23 |
copyright |
24 |
" |
|
25 |
COPYRIGHT (c) 1999 by eXept Software AG |
|
26 |
All Rights Reserved |
|
27 |
||
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
||
36 |
! |
|
37 |
||
4509 | 38 |
documentation |
39 |
" |
|
40 |
AutoloadMetaclass catches unhandled class methods, files in |
|
41 |
the corresponding code when first used and resends the catched |
|
42 |
message to the now existing class. |
|
43 |
||
44 |
Autoload installs AutoloadMetaclass as its metaclass in #initialize. |
|
45 |
||
46 |
[author:] |
|
47 |
Stefan Vogel |
|
48 |
||
49 |
[see also:] |
|
50 |
Autoload |
|
51 |
" |
|
52 |
! ! |
|
53 |
||
54 |
!AutoloadMetaclass methodsFor:'message catching'! |
|
55 |
||
56 |
doesNotUnderstand:aMessage |
|
57 |
"caught a message; load the class and retry the message" |
|
58 |
||
59 |
|newClass| |
|
60 |
||
17732
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
61 |
(myClass isNil or:[myClass == Autoload]) ifTrue:[ |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
62 |
"take care: subclassing Autoload must still be possible" |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
63 |
^ self perform:aMessage selector inClass:Metaclass withArguments:aMessage arguments. |
4509 | 64 |
]. |
17757 | 65 |
newClass := myClass autoload. |
66 |
(newClass notNil and:[newClass isLoaded]) ifTrue:[ |
|
67 |
^ aMessage sendTo:newClass class |
|
68 |
]. |
|
69 |
||
70 |
Transcript showCR:'Autoload [warning]: failed to autoload ',self name. |
|
4509 | 71 |
^ super doesNotUnderstand:aMessage |
72 |
||
73 |
" |
|
17732
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
74 |
Wrapper unload. |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
75 |
Wrapper class xxx |
4509 | 76 |
|
17732
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
77 |
Wrapper unload. |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
78 |
Wrapper |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
79 |
subclass:#TTTT |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
80 |
instanceVariableNames:'' |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
81 |
classVariableNames:'' |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
82 |
poolDictionaries:'' |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
83 |
category:'AAAA-Test' |
4509 | 84 |
" |
85 |
||
86 |
"Modified: / 3.8.1999 / 13:57:05 / stefan" |
|
17732
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
87 |
! |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
88 |
|
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
89 |
new |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
90 |
"catch - load the class and send it to the real one" |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
91 |
|
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
92 |
^ self doesNotUnderstand:(Message selector:#new) |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
93 |
! |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
94 |
|
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
95 |
newClassBuilder |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
96 |
"catch - load the class and send it to the real one" |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
97 |
|
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
98 |
^ self doesNotUnderstand:(Message selector:#newClassBuilder) |
4509 | 99 |
! ! |
100 |
||
101 |
!AutoloadMetaclass class methodsFor:'documentation'! |
|
102 |
||
103 |
version |
|
17865 | 104 |
^ '$Id: AutoloadMetaclass.st 10695 2011-09-28 19:07:49Z vranyj1 $' |
17732
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
105 |
! |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
106 |
|
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
107 |
version_CVS |
17845 | 108 |
^ '§Header: /cvs/stx/stx/libbasic/AutoloadMetaclass.st,v 1.8 2010/04/03 10:47:04 cg Exp §' |
17865 | 109 |
! |
110 |
||
111 |
version_SVN |
|
112 |
^ '$Id: AutoloadMetaclass.st 10695 2011-09-28 19:07:49Z vranyj1 $' |
|
17846 | 113 |
! ! |