author | Claus Gittinger <cg@exept.de> |
Fri, 28 Jun 2019 08:49:56 +0200 | |
changeset 24385 | dd84e4dfb5cc |
parent 17125 | 659c75d64eb1 |
child 18120 | e3a375d5f6a8 |
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 |
||
17125 | 46 |
See details of the why and how of autoloading in the Autoload class. |
47 |
||
4509 | 48 |
[author:] |
49 |
Stefan Vogel |
|
50 |
||
51 |
[see also:] |
|
52 |
Autoload |
|
53 |
" |
|
54 |
! ! |
|
55 |
||
56 |
!AutoloadMetaclass methodsFor:'message catching'! |
|
57 |
||
58 |
doesNotUnderstand:aMessage |
|
59 |
"caught a message; load the class and retry the message" |
|
60 |
||
61 |
|newClass| |
|
62 |
||
12261
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
63 |
(myClass isNil or:[myClass == Autoload]) ifTrue:[ |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
64 |
"take care: subclassing Autoload must still be possible" |
12272 | 65 |
^ self perform:aMessage selector inClass:Metaclass withArguments:aMessage arguments. |
4509 | 66 |
]. |
12836
16dfb973e06c
format in: #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
12272
diff
changeset
|
67 |
newClass := myClass autoload. |
16dfb973e06c
format in: #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
12272
diff
changeset
|
68 |
(newClass notNil and:[newClass isLoaded]) ifTrue:[ |
16dfb973e06c
format in: #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
12272
diff
changeset
|
69 |
^ aMessage sendTo:newClass class |
16dfb973e06c
format in: #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
12272
diff
changeset
|
70 |
]. |
16dfb973e06c
format in: #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
12272
diff
changeset
|
71 |
|
16dfb973e06c
format in: #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
12272
diff
changeset
|
72 |
Transcript showCR:'Autoload [warning]: failed to autoload ',self name. |
4509 | 73 |
^ super doesNotUnderstand:aMessage |
74 |
||
75 |
" |
|
12261
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
76 |
Wrapper unload. |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
77 |
Wrapper class xxx |
4509 | 78 |
|
12261
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
79 |
Wrapper unload. |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
80 |
Wrapper |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
81 |
subclass:#TTTT |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
82 |
instanceVariableNames:'' |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
83 |
classVariableNames:'' |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
84 |
poolDictionaries:'' |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
85 |
category:'AAAA-Test' |
4509 | 86 |
" |
87 |
||
88 |
"Modified: / 3.8.1999 / 13:57:05 / stefan" |
|
12261
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
89 |
! |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
90 |
|
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
91 |
new |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
92 |
"catch - load the class and send it to the real one" |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
93 |
|
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
94 |
^ self doesNotUnderstand:(Message selector:#new) |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
95 |
! |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
96 |
|
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
97 |
newClassBuilder |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
98 |
"catch - load the class and send it to the real one" |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
99 |
|
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
100 |
^ self doesNotUnderstand:(Message selector:#newClassBuilder) |
4509 | 101 |
! ! |
102 |
||
103 |
!AutoloadMetaclass class methodsFor:'documentation'! |
|
104 |
||
105 |
version |
|
17125 | 106 |
^ '$Header: /cvs/stx/stx/libbasic/AutoloadMetaclass.st,v 1.9 2014-11-26 09:10:20 cg Exp $' |
12261
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
107 |
! |
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
108 |
|
7ecada6b94dc
Catch messages used for subclass creation
Stefan Vogel <sv@exept.de>
parents:
11112
diff
changeset
|
109 |
version_CVS |
17125 | 110 |
^ '$Header: /cvs/stx/stx/libbasic/AutoloadMetaclass.st,v 1.9 2014-11-26 09:10:20 cg Exp $' |
4509 | 111 |
! ! |
17125 | 112 |