1731
|
1 |
Metaclass subclass:#PrivateMetaclass
|
|
2 |
instanceVariableNames:'owningClass'
|
|
3 |
classVariableNames:''
|
|
4 |
poolDictionaries:''
|
|
5 |
category:'Kernel-Classes'
|
|
6 |
!
|
|
7 |
|
1737
|
8 |
!PrivateMetaclass class methodsFor:'documentation'!
|
1731
|
9 |
|
|
10 |
documentation
|
|
11 |
"
|
|
12 |
A PrivateMetaclass is much like a regular Metaclass, but it is only visible (known)
|
|
13 |
to some owningClass (which is also true for the PrivateMetaclasses sole instance).
|
|
14 |
|
1755
|
15 |
Its sourceCode, package and revision is forced to be the same as the owning classes'.
|
|
16 |
Therefore, privateClasses delegate some queries to their owning class.
|
1731
|
17 |
|
1807
|
18 |
Caution: support for private classes is an ST/X special feature.
|
|
19 |
This mechanism may not be provided by other smalltalk systems,
|
|
20 |
making your code unportable.
|
|
21 |
(However, private classes can be simulated pretty easily, using classVariables
|
|
22 |
or classInstance variables ...)
|
|
23 |
|
1731
|
24 |
[author:]
|
|
25 |
Claus Gittinger
|
|
26 |
|
|
27 |
[see also:]
|
|
28 |
Behavior ClassDescription Class Metaclass
|
|
29 |
"
|
|
30 |
! !
|
|
31 |
|
|
32 |
!PrivateMetaclass methodsFor:'accessing'!
|
|
33 |
|
1920
|
34 |
nameSpace
|
|
35 |
"return the nameSpace I am contained in.
|
|
36 |
For private classes, this is always nil"
|
|
37 |
|
|
38 |
^ nil
|
|
39 |
|
|
40 |
"Created: 7.11.1996 / 13:19:18 / cg"
|
|
41 |
!
|
|
42 |
|
1731
|
43 |
owningClass
|
|
44 |
"return my owningClass"
|
|
45 |
|
|
46 |
^ owningClass
|
|
47 |
|
|
48 |
"Created: 11.10.1996 / 16:55:43 / cg"
|
|
49 |
"Modified: 11.10.1996 / 17:35:13 / cg"
|
|
50 |
!
|
|
51 |
|
|
52 |
setOwningClass:something
|
|
53 |
"set my owningClass - this is not a public entry"
|
|
54 |
|
|
55 |
owningClass := something.
|
|
56 |
|
|
57 |
"Created: 11.10.1996 / 17:11:05 / cg"
|
|
58 |
"Modified: 11.10.1996 / 17:35:24 / cg"
|
2048
|
59 |
!
|
|
60 |
|
|
61 |
topOwningClass
|
|
62 |
"return my outermost owningClass; that is the first non-private
|
|
63 |
class along the owner-chain."
|
|
64 |
|
|
65 |
|outerOwner|
|
|
66 |
|
|
67 |
(outerOwner := owningClass owningClass) notNil ifTrue:[
|
|
68 |
^ owningClass topOwningClass
|
|
69 |
].
|
|
70 |
^ owningClass
|
|
71 |
|
|
72 |
"Created: 3.1.1997 / 19:19:58 / cg"
|
|
73 |
"Modified: 3.1.1997 / 19:50:05 / cg"
|
1731
|
74 |
! !
|
|
75 |
|
|
76 |
!PrivateMetaclass methodsFor:'queries'!
|
|
77 |
|
|
78 |
isBuiltInClass
|
1755
|
79 |
^ self == PrivateMetaclass
|
1757
|
80 |
!
|
|
81 |
|
|
82 |
package
|
|
83 |
"return my package-id"
|
|
84 |
|
|
85 |
^ owningClass package
|
|
86 |
|
|
87 |
"Created: 15.10.1996 / 19:45:04 / cg"
|
1731
|
88 |
! !
|
|
89 |
|
1738
|
90 |
!PrivateMetaclass class methodsFor:'documentation'!
|
1731
|
91 |
|
|
92 |
version
|
2048
|
93 |
^ '$Header: /cvs/stx/stx/libbasic/Attic/PMetaclass.st,v 1.10 1997-01-03 18:52:14 cg Exp $'
|
1731
|
94 |
! !
|