author | vranyj1 |
Wed, 20 Jul 2011 12:02:02 +0000 | |
branch | jk_new_structure |
changeset 873 | 933263bd2d27 |
parent 811 | 2921f70489c1 |
child 877 | f5a5b93e1c78 |
permissions | -rw-r--r-- |
752 | 1 |
" |
2 |
COPYRIGHT (c) 1997 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 |
" |
|
12 |
"{ Package: 'stx:libjava' }" |
|
13 |
||
14 |
JavaRef subclass:#JavaField |
|
15 |
instanceVariableNames:'accessFlags index name signature constantValue annotations |
|
16 |
constantPool' |
|
17 |
classVariableNames:'A_FINAL A_PRIVATE A_PROTECTED A_PUBLIC A_STATIC A_TRANSIENT |
|
18 |
A_VOLATILE A_SMALLTALK A_SYBTHETIC A_ENUM FieldTypeClasses' |
|
19 |
poolDictionaries:'' |
|
20 |
category:'Languages-Java-Reader-Support' |
|
21 |
! |
|
22 |
||
23 |
!JavaField class methodsFor:'documentation'! |
|
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
28 |
All Rights Reserved |
|
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
||
38 |
||
39 |
! ! |
|
40 |
||
41 |
!JavaField class methodsFor:'class initialization'! |
|
42 |
||
43 |
initialize |
|
44 |
A_PUBLIC := 16r0001. "/ JavaClass A_PUBLIC |
|
45 |
A_PRIVATE := 16r0002. |
|
46 |
A_PROTECTED := 16r0004. |
|
47 |
A_STATIC := 16r0008. |
|
48 |
A_FINAL := 16r0010. "/ JavaClass A_FINAL |
|
49 |
A_VOLATILE := 16r0040. |
|
50 |
A_TRANSIENT := 16r0080. |
|
51 |
A_SYBTHETIC := 16r1000. |
|
52 |
A_ENUM := 16r4000. |
|
53 |
||
54 |
FieldTypeClasses := IdentityDictionary new |
|
55 |
"Base types" |
|
873
933263bd2d27
Fixes for primitive array types (uses Signed* variant of an array)
vranyj1
parents:
811
diff
changeset
|
56 |
"/WARNING: If you change something here, you MUST also |
933263bd2d27
Fixes for primitive array types (uses Signed* variant of an array)
vranyj1
parents:
811
diff
changeset
|
57 |
"/ change JavaDescriptor class>>#initialize !!!!!! |
933263bd2d27
Fixes for primitive array types (uses Signed* variant of an array)
vranyj1
parents:
811
diff
changeset
|
58 |
|
933263bd2d27
Fixes for primitive array types (uses Signed* variant of an array)
vranyj1
parents:
811
diff
changeset
|
59 |
at: #B put: Byte; |
752 | 60 |
at: #C put: Character; |
61 |
at: #D put: Float; |
|
62 |
at: #F put: ShortFloat; |
|
63 |
at: #I put: Integer; "Kludge: instances of java int are in fact SmallIntegers" |
|
64 |
at: #J put: LargeInteger; |
|
873
933263bd2d27
Fixes for primitive array types (uses Signed* variant of an array)
vranyj1
parents:
811
diff
changeset
|
65 |
at: #S put: Short; |
752 | 66 |
at: #Z put: Boolean; |
67 |
||
68 |
"Array types" |
|
873
933263bd2d27
Fixes for primitive array types (uses Signed* variant of an array)
vranyj1
parents:
811
diff
changeset
|
69 |
"/WARNING: If you change something here, you MUST also |
933263bd2d27
Fixes for primitive array types (uses Signed* variant of an array)
vranyj1
parents:
811
diff
changeset
|
70 |
"/ change JavaDescriptor class>>#initialize !!!!!! |
752 | 71 |
at: #'[B' put: ByteArray; |
873
933263bd2d27
Fixes for primitive array types (uses Signed* variant of an array)
vranyj1
parents:
811
diff
changeset
|
72 |
at: #'[C' put: Unicode32String; |
752 | 73 |
at: #'[D' put: DoubleArray; |
74 |
at: #'[F' put: FloatArray; |
|
873
933263bd2d27
Fixes for primitive array types (uses Signed* variant of an array)
vranyj1
parents:
811
diff
changeset
|
75 |
at: #'[I' put: SignedIntegerArray; "Kludge: instances of java int are in fact SmallIntegers" |
933263bd2d27
Fixes for primitive array types (uses Signed* variant of an array)
vranyj1
parents:
811
diff
changeset
|
76 |
at: #'[J' put: SignedLongIntegerArray; |
933263bd2d27
Fixes for primitive array types (uses Signed* variant of an array)
vranyj1
parents:
811
diff
changeset
|
77 |
at: #'[S' put: WordArray; |
752 | 78 |
at: #'[Z' put: BooleanArray; |
79 |
||
80 |
yourself |
|
81 |
||
82 |
||
83 |
||
84 |
||
85 |
" |
|
86 |
self initialize |
|
87 |
" |
|
88 |
||
89 |
"Modified: / 13-05-1998 / 14:44:43 / cg" |
|
873
933263bd2d27
Fixes for primitive array types (uses Signed* variant of an array)
vranyj1
parents:
811
diff
changeset
|
90 |
"Modified: / 20-07-2011 / 10:42:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 91 |
! ! |
92 |
||
93 |
!JavaField class methodsFor:'constants'! |
|
94 |
||
95 |
A_FINAL |
|
96 |
^ A_FINAL |
|
97 |
||
98 |
||
99 |
! |
|
100 |
||
101 |
A_PRIVATE |
|
102 |
^ A_PRIVATE |
|
103 |
||
104 |
||
105 |
! |
|
106 |
||
107 |
A_PROTECTED |
|
108 |
^ A_PROTECTED |
|
109 |
||
110 |
"Created: / 13.5.1998 / 13:03:51 / cg" |
|
111 |
! |
|
112 |
||
113 |
A_PUBLIC |
|
114 |
^ A_PUBLIC |
|
115 |
||
116 |
||
117 |
! |
|
118 |
||
119 |
A_STATIC |
|
120 |
^ A_STATIC |
|
121 |
||
122 |
"Created: / 13.5.1998 / 13:03:55 / cg" |
|
123 |
! |
|
124 |
||
125 |
A_TRANSIENT |
|
126 |
^ A_TRANSIENT |
|
127 |
||
128 |
||
129 |
! |
|
130 |
||
131 |
A_VOLATILE |
|
132 |
^ A_VOLATILE |
|
133 |
||
134 |
||
135 |
! ! |
|
136 |
||
137 |
!JavaField methodsFor:'accessing'! |
|
138 |
||
139 |
accessFlags |
|
140 |
^ accessFlags |
|
141 |
! |
|
142 |
||
143 |
annotations |
|
144 |
^ annotations |
|
145 |
! |
|
146 |
||
147 |
annotations:something |
|
148 |
annotations := something. |
|
149 |
! |
|
150 |
||
151 |
constantPool |
|
152 |
^ constantPool. |
|
153 |
||
154 |
"Created: / 17-12-2010 / 18:40:23 / Marcel Hlopko <hlopik@gmail.com>" |
|
155 |
! |
|
156 |
||
157 |
constantPool:something |
|
158 |
constantPool := something. |
|
159 |
||
160 |
"Created: / 17-12-2010 / 18:41:59 / Marcel Hlopko <hlopik@gmail.com>" |
|
161 |
! |
|
162 |
||
163 |
constantValue |
|
164 |
^ constantValue |
|
165 |
! |
|
166 |
||
167 |
constantValue:aValue |
|
168 |
constantValue := aValue |
|
169 |
! |
|
170 |
||
171 |
ensureHasAnnotations |
|
172 |
annotations ifNil: [ annotations := JavaAnnotationContainer for:self ]. |
|
173 |
^ annotations |
|
174 |
||
175 |
"Created: / 25-02-2011 / 16:04:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
176 |
"Modified: / 16-03-2011 / 17:13:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
177 |
! |
|
178 |
||
179 |
index |
|
180 |
^ index |
|
181 |
! |
|
182 |
||
183 |
name |
|
184 |
^ name |
|
185 |
! |
|
186 |
||
187 |
signature |
|
188 |
^ signature |
|
189 |
||
190 |
"Created: / 15.10.1998 / 10:37:06 / cg" |
|
191 |
! ! |
|
192 |
||
193 |
!JavaField methodsFor:'printing & storing'! |
|
194 |
||
811 | 195 |
printOn: aStream |
752 | 196 |
|
811 | 197 |
super printOn: aStream. |
198 |
aStream |
|
199 |
nextPutAll:'(name: '; |
|
200 |
nextPutAll: name; |
|
201 |
nextPut:$,; space; |
|
202 |
nextPutAll:'descriptor: '; |
|
203 |
nextPutAll: signature; |
|
204 |
nextPut:$) |
|
752 | 205 |
|
811 | 206 |
"Created: / 22-05-2011 / 16:07:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 207 |
! ! |
208 |
||
209 |
!JavaField methodsFor:'private accessing'! |
|
210 |
||
211 |
setAccessFlags:flags |
|
212 |
accessFlags := flags. |
|
213 |
||
214 |
"Created: 16.4.1996 / 13:04:25 / cg" |
|
215 |
! |
|
216 |
||
217 |
setClass:aClass |
|
218 |
||
219 |
class := aClass. |
|
220 |
||
221 |
"Created: / 22-11-2010 / 17:12:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
222 |
! |
|
223 |
||
224 |
setConstantValue:something |
|
225 |
constantValue := something. |
|
226 |
||
227 |
"Created: 16.4.1996 / 13:04:58 / cg" |
|
228 |
! |
|
229 |
||
230 |
setIndex:anInteger |
|
231 |
index := anInteger. |
|
232 |
||
233 |
"Created: / 22-11-2010 / 17:13:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
234 |
! |
|
235 |
||
236 |
setName:aString |
|
237 |
name := aString. |
|
238 |
||
239 |
"Created: 16.4.1996 / 13:04:35 / cg" |
|
240 |
! |
|
241 |
||
242 |
setSignature:aString |
|
243 |
signature := aString. |
|
244 |
||
245 |
"Created: 16.4.1996 / 13:04:43 / cg" |
|
246 |
! ! |
|
247 |
||
248 |
!JavaField methodsFor:'queries'! |
|
249 |
||
250 |
initialValue |
|
251 |
^ JavaClass initialValueFromSignature:signature |
|
252 |
||
253 |
||
254 |
! |
|
255 |
||
256 |
isFinal |
|
257 |
^ (accessFlags bitAnd:A_FINAL) ~~ 0 |
|
258 |
||
259 |
"Modified: / 13.5.1998 / 12:59:26 / cg" |
|
260 |
! |
|
261 |
||
262 |
isPrivate |
|
263 |
^ (accessFlags bitAnd:A_PRIVATE) ~~ 0 |
|
264 |
||
265 |
"Modified: / 13.5.1998 / 12:59:30 / cg" |
|
266 |
! |
|
267 |
||
268 |
isProtected |
|
269 |
^ (accessFlags bitAnd:A_PROTECTED) ~~ 0 |
|
270 |
||
271 |
"Modified: / 13.5.1998 / 12:59:35 / cg" |
|
272 |
! |
|
273 |
||
274 |
isPublic |
|
275 |
^ (accessFlags bitAnd:A_PUBLIC) ~~ 0 |
|
276 |
||
277 |
"Modified: / 13.5.1998 / 12:59:40 / cg" |
|
278 |
! |
|
279 |
||
280 |
isStatic |
|
281 |
^ (accessFlags bitAnd:A_STATIC) ~~ 0 |
|
282 |
||
283 |
"Modified: / 13.5.1998 / 12:59:43 / cg" |
|
284 |
! |
|
285 |
||
286 |
isTransient |
|
287 |
^ (accessFlags bitAnd:A_TRANSIENT) ~~ 0 |
|
288 |
||
289 |
"Modified: / 13.5.1998 / 12:59:51 / cg" |
|
290 |
! |
|
291 |
||
292 |
isVolatile |
|
293 |
^ (accessFlags bitAnd:A_VOLATILE) ~~ 0 |
|
294 |
||
295 |
"Modified: / 13.5.1998 / 12:59:56 / cg" |
|
296 |
! |
|
297 |
||
298 |
type |
|
299 |
^ JavaMethod typeFromSignature:signature in:nil |
|
300 |
||
301 |
"Modified: / 8.1.1998 / 19:13:22 / cg" |
|
302 |
! |
|
303 |
||
304 |
typeClass |
|
305 |
||
306 |
^(JavaDescriptor fromString: signature) javaClass. |
|
307 |
||
308 |
"Created: / 23-11-2010 / 17:02:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
309 |
"Modified: / 25-11-2010 / 18:35:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
310 |
! ! |
|
311 |
||
312 |
!JavaField class methodsFor:'documentation'! |
|
313 |
||
314 |
version |
|
873
933263bd2d27
Fixes for primitive array types (uses Signed* variant of an array)
vranyj1
parents:
811
diff
changeset
|
315 |
^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaField.st,v 1.17 2009/10/09 14:04:34 cg Exp $' |
752 | 316 |
! |
317 |
||
318 |
version_CVS |
|
319 |
^ '§Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaField.st,v 1.17 2009/10/09 14:04:34 cg Exp §' |
|
320 |
! |
|
321 |
||
322 |
version_SVN |
|
323 |
^ '$Id$' |
|
324 |
! ! |
|
325 |
||
326 |
JavaField initialize! |