author | Marcel Hlopko <marcel.hlopko@fit.cvut.cz> |
Tue, 18 Dec 2012 18:42:43 +0100 | |
branch | development |
changeset 1908 | 923de168f3d6 |
parent 1864 | 60a8dc26c8c6 |
child 2069 | 75d40b7b986f |
permissions | -rw-r--r-- |
1390 | 1 |
" |
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
3 |
||
4 |
New code and modifications done at SWING Research Group [1]: |
|
5 |
||
6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
|
7 |
SWING Research Group, Czech Technical University in Prague |
|
8 |
||
9 |
This software is furnished under a license and may be used |
|
10 |
only in accordance with the terms of that license and with the |
|
11 |
inclusion of the above copyright notice. This software may not |
|
12 |
be provided or otherwise made available to, or used by, any |
|
13 |
other person. No title to or ownership of the software is |
|
14 |
hereby transferred. |
|
15 |
||
16 |
[1] Code written at SWING Research Group contains a signature |
|
17 |
of one of the above copright owners. For exact set of such code, |
|
18 |
see the differences between this version and version stx:libjava |
|
19 |
as of 1.9.2010 |
|
20 |
" |
|
21 |
"{ Package: 'stx:libjava' }" |
|
22 |
||
23 |
Object subclass:#JavaClassAccessor |
|
1430 | 24 |
instanceVariableNames:'name fullName package loading' |
1390 | 25 |
classVariableNames:'' |
26 |
poolDictionaries:'' |
|
27 |
category:'Languages-Java-Classes' |
|
28 |
! |
|
29 |
||
30 |
!JavaClassAccessor class methodsFor:'documentation'! |
|
31 |
||
32 |
copyright |
|
33 |
" |
|
34 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
35 |
||
36 |
New code and modifications done at SWING Research Group [1]: |
|
37 |
||
38 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
|
39 |
SWING Research Group, Czech Technical University in Prague |
|
40 |
||
41 |
This software is furnished under a license and may be used |
|
42 |
only in accordance with the terms of that license and with the |
|
43 |
inclusion of the above copyright notice. This software may not |
|
44 |
be provided or otherwise made available to, or used by, any |
|
45 |
other person. No title to or ownership of the software is |
|
46 |
hereby transferred. |
|
47 |
||
48 |
[1] Code written at SWING Research Group contains a signature |
|
49 |
of one of the above copright owners. For exact set of such code, |
|
50 |
see the differences between this version and version stx:libjava |
|
51 |
as of 1.9.2010 |
|
52 |
||
53 |
" |
|
54 |
! ! |
|
55 |
||
56 |
!JavaClassAccessor class methodsFor:'instance creation'! |
|
57 |
||
58 |
fullName: aSymbol |
|
59 |
||
60 |
^self new setFullName: aSymbol |
|
61 |
||
62 |
"Created: / 28-02-2012 / 19:20:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
63 |
! ! |
|
64 |
||
65 |
!JavaClassAccessor methodsFor:'accessing'! |
|
66 |
||
67 |
fullName |
|
68 |
^ fullName |
|
69 |
! |
|
70 |
||
71 |
name |
|
72 |
"Returns Smalltalk name" |
|
73 |
^name |
|
74 |
||
75 |
"Created: / 28-02-2012 / 19:48:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
76 |
! |
|
77 |
||
78 |
theClass |
|
79 |
| cls | |
|
80 |
||
81 |
cls := self theClassOrNil. |
|
1430 | 82 |
cls isNil ifTrue:[ |
83 |
[ |
|
84 |
loading := true. |
|
85 |
cls := Java classForName: (fullName copyReplaceAll: $/ with: $.) |
|
86 |
] ensure:[ |
|
87 |
loading := false |
|
88 |
]. |
|
89 |
]. |
|
1390 | 90 |
^cls |
91 |
||
92 |
"Created: / 28-02-2012 / 19:22:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
93 |
! |
|
94 |
||
95 |
theClassOrNil |
|
1453 | 96 |
|
97 |
| cls | |
|
98 |
[ |
|
99 |
loading := true. |
|
100 |
cls := JavaVM registry classNamed: fullName. |
|
1698
d32a2a3dce36
- Some more support for non-Java extension methods.
vranyj1
parents:
1459
diff
changeset
|
101 |
cls isNil ifTrue:[ |
d32a2a3dce36
- Some more support for non-Java extension methods.
vranyj1
parents:
1459
diff
changeset
|
102 |
"Hmm...maybe somebody will provide me the class, let's try" |
d32a2a3dce36
- Some more support for non-Java extension methods.
vranyj1
parents:
1459
diff
changeset
|
103 |
cls := JavaClassQuery query: fullName |
d32a2a3dce36
- Some more support for non-Java extension methods.
vranyj1
parents:
1459
diff
changeset
|
104 |
]. |
1453 | 105 |
] ensure:[ |
106 |
loading := false. |
|
107 |
]. |
|
108 |
^cls |
|
1390 | 109 |
|
110 |
"Created: / 28-02-2012 / 19:47:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
111 |
! ! |
|
112 |
||
113 |
!JavaClassAccessor methodsFor:'error handling'! |
|
114 |
||
115 |
doesNotUnderstand: aMessage |
|
116 |
||
117 |
^aMessage sendTo: self theClass |
|
118 |
||
119 |
"Created: / 28-02-2012 / 19:37:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
120 |
! ! |
|
121 |
||
1459 | 122 |
!JavaClassAccessor methodsFor:'exception handling support'! |
123 |
||
124 |
isExceptionCreator |
|
125 |
||
126 |
loading ifTrue:[ ^ false ]. |
|
127 |
^self theClass isThrowable |
|
128 |
||
129 |
"Created: / 18-03-2012 / 20:34:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
130 |
! |
|
131 |
||
132 |
isExceptionHandler |
|
133 |
loading ifTrue:[ ^ false ]. |
|
134 |
^self theClass isThrowable |
|
135 |
||
136 |
"Created: / 18-03-2012 / 14:18:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
137 |
! ! |
|
138 |
||
1390 | 139 |
!JavaClassAccessor methodsFor:'initialization'! |
140 |
||
141 |
setFullName: aSymbol |
|
142 |
fullName := aSymbol. |
|
143 |
name := 'JAVA::' , ((fullName tokensBasedOn: $/) asStringWith: '::') |
|
144 |
||
145 |
"Created: / 28-02-2012 / 19:21:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
146 |
! ! |
|
147 |
||
148 |
!JavaClassAccessor methodsFor:'instance creation'! |
|
149 |
||
1793 | 150 |
basicNew |
151 |
||
152 |
^self theClass basicNew |
|
153 |
||
154 |
"Created: / 02-11-2012 / 21:09:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
155 |
! |
|
156 |
||
1390 | 157 |
new |
158 |
||
159 |
^self theClass new |
|
160 |
||
161 |
"Created: / 28-02-2012 / 19:34:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
162 |
! |
|
163 |
||
164 |
newCleared |
|
1793 | 165 |
<resource: #obsolete> |
166 |
"Use basicNew" |
|
1390 | 167 |
|
1793 | 168 |
^self theClass basicNew |
1390 | 169 |
|
170 |
"Created: / 28-02-2012 / 19:34:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1793 | 171 |
"Modified: / 02-11-2012 / 21:09:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1390 | 172 |
! ! |
173 |
||
174 |
!JavaClassAccessor methodsFor:'printing & storing'! |
|
175 |
||
176 |
printOn:aStream |
|
177 |
aStream nextPutAll: 'JAVA '. |
|
178 |
(fullName tokensBasedOn: $/) |
|
179 |
do:[:component|aStream nextPutAll: component] |
|
180 |
separatedBy:[aStream space]. |
|
181 |
||
182 |
"Modified: / 28-02-2012 / 20:27:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
183 |
! ! |
|
184 |
||
185 |
!JavaClassAccessor methodsFor:'testing'! |
|
186 |
||
187 |
isBehavior |
|
188 |
||
189 |
^true |
|
190 |
||
191 |
"Created: / 28-02-2012 / 19:36:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
192 |
! |
|
193 |
||
194 |
isClass |
|
195 |
||
196 |
^true |
|
197 |
||
198 |
"Created: / 28-02-2012 / 20:00:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
199 |
! |
|
200 |
||
201 |
isJavaClass |
|
202 |
||
203 |
^true |
|
204 |
||
205 |
"Created: / 28-02-2012 / 20:08:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1430 | 206 |
! |
207 |
||
208 |
isLoaded |
|
209 |
||
210 |
loading ifTrue:[ ^ false ]. |
|
211 |
self theClass. "/Force load" |
|
212 |
^true |
|
213 |
||
214 |
"Created: / 19-03-2012 / 10:44:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1390 | 215 |
! ! |
216 |
||
217 |
!JavaClassAccessor class methodsFor:'documentation'! |
|
218 |
||
1864 | 219 |
version_HG |
220 |
||
221 |
^ '$Changeset: <not expanded> $' |
|
222 |
! |
|
223 |
||
1390 | 224 |
version_SVN |
1864 | 225 |
^ '§Id§' |
1390 | 226 |
! ! |