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"
|
|
56 |
at: #B put: SmallInteger;
|
|
57 |
at: #C put: Character;
|
|
58 |
at: #D put: Float;
|
|
59 |
at: #F put: ShortFloat;
|
|
60 |
at: #I put: Integer; "Kludge: instances of java int are in fact SmallIntegers"
|
|
61 |
at: #J put: LargeInteger;
|
|
62 |
at: #S put: SmallInteger;
|
|
63 |
at: #Z put: Boolean;
|
|
64 |
|
|
65 |
"Array types"
|
|
66 |
at: #'[B' put: ByteArray;
|
|
67 |
at: #'[C' put: String;
|
|
68 |
at: #'[D' put: DoubleArray;
|
|
69 |
at: #'[F' put: FloatArray;
|
|
70 |
at: #'[I' put: IntegerArray; "Kludge: instances of java int are in fact SmallIntegers"
|
|
71 |
at: #'[J' put: Array;
|
|
72 |
at: #'[S' put: Array;
|
|
73 |
at: #'[Z' put: BooleanArray;
|
|
74 |
|
|
75 |
yourself
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
"
|
|
81 |
self initialize
|
|
82 |
"
|
|
83 |
|
|
84 |
"Modified: / 13-05-1998 / 14:44:43 / cg"
|
|
85 |
"Modified: / 23-11-2010 / 20:00:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
86 |
! !
|
|
87 |
|
|
88 |
!JavaField class methodsFor:'constants'!
|
|
89 |
|
|
90 |
A_FINAL
|
|
91 |
^ A_FINAL
|
|
92 |
|
|
93 |
|
|
94 |
!
|
|
95 |
|
|
96 |
A_PRIVATE
|
|
97 |
^ A_PRIVATE
|
|
98 |
|
|
99 |
|
|
100 |
!
|
|
101 |
|
|
102 |
A_PROTECTED
|
|
103 |
^ A_PROTECTED
|
|
104 |
|
|
105 |
"Created: / 13.5.1998 / 13:03:51 / cg"
|
|
106 |
!
|
|
107 |
|
|
108 |
A_PUBLIC
|
|
109 |
^ A_PUBLIC
|
|
110 |
|
|
111 |
|
|
112 |
!
|
|
113 |
|
|
114 |
A_STATIC
|
|
115 |
^ A_STATIC
|
|
116 |
|
|
117 |
"Created: / 13.5.1998 / 13:03:55 / cg"
|
|
118 |
!
|
|
119 |
|
|
120 |
A_TRANSIENT
|
|
121 |
^ A_TRANSIENT
|
|
122 |
|
|
123 |
|
|
124 |
!
|
|
125 |
|
|
126 |
A_VOLATILE
|
|
127 |
^ A_VOLATILE
|
|
128 |
|
|
129 |
|
|
130 |
! !
|
|
131 |
|
|
132 |
!JavaField methodsFor:'accessing'!
|
|
133 |
|
|
134 |
accessFlags
|
|
135 |
^ accessFlags
|
|
136 |
!
|
|
137 |
|
|
138 |
annotations
|
|
139 |
^ annotations
|
|
140 |
!
|
|
141 |
|
|
142 |
annotations:something
|
|
143 |
annotations := something.
|
|
144 |
!
|
|
145 |
|
|
146 |
constantPool
|
|
147 |
^ constantPool.
|
|
148 |
|
|
149 |
"Created: / 17-12-2010 / 18:40:23 / Marcel Hlopko <hlopik@gmail.com>"
|
|
150 |
!
|
|
151 |
|
|
152 |
constantPool:something
|
|
153 |
constantPool := something.
|
|
154 |
|
|
155 |
"Created: / 17-12-2010 / 18:41:59 / Marcel Hlopko <hlopik@gmail.com>"
|
|
156 |
!
|
|
157 |
|
|
158 |
constantValue
|
|
159 |
^ constantValue
|
|
160 |
!
|
|
161 |
|
|
162 |
constantValue:aValue
|
|
163 |
constantValue := aValue
|
|
164 |
!
|
|
165 |
|
|
166 |
ensureHasAnnotations
|
|
167 |
annotations ifNil: [ annotations := JavaAnnotationContainer for:self ].
|
|
168 |
^ annotations
|
|
169 |
|
|
170 |
"Created: / 25-02-2011 / 16:04:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
171 |
"Modified: / 16-03-2011 / 17:13:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
172 |
!
|
|
173 |
|
|
174 |
index
|
|
175 |
^ index
|
|
176 |
!
|
|
177 |
|
|
178 |
name
|
|
179 |
^ name
|
|
180 |
!
|
|
181 |
|
|
182 |
signature
|
|
183 |
^ signature
|
|
184 |
|
|
185 |
"Created: / 15.10.1998 / 10:37:06 / cg"
|
|
186 |
! !
|
|
187 |
|
|
188 |
!JavaField methodsFor:'printing & storing'!
|
|
189 |
|
|
190 |
displayString
|
|
191 |
^ self class name , '(name: ' , name displayString , ')'
|
|
192 |
|
|
193 |
|
|
194 |
! !
|
|
195 |
|
|
196 |
!JavaField methodsFor:'private accessing'!
|
|
197 |
|
|
198 |
setAccessFlags:flags
|
|
199 |
accessFlags := flags.
|
|
200 |
|
|
201 |
"Created: 16.4.1996 / 13:04:25 / cg"
|
|
202 |
!
|
|
203 |
|
|
204 |
setClass:aClass
|
|
205 |
|
|
206 |
class := aClass.
|
|
207 |
|
|
208 |
"Created: / 22-11-2010 / 17:12:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
209 |
!
|
|
210 |
|
|
211 |
setConstantValue:something
|
|
212 |
constantValue := something.
|
|
213 |
|
|
214 |
"Created: 16.4.1996 / 13:04:58 / cg"
|
|
215 |
!
|
|
216 |
|
|
217 |
setIndex:anInteger
|
|
218 |
index := anInteger.
|
|
219 |
|
|
220 |
"Created: / 22-11-2010 / 17:13:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
221 |
!
|
|
222 |
|
|
223 |
setName:aString
|
|
224 |
name := aString.
|
|
225 |
|
|
226 |
"Created: 16.4.1996 / 13:04:35 / cg"
|
|
227 |
!
|
|
228 |
|
|
229 |
setSignature:aString
|
|
230 |
signature := aString.
|
|
231 |
|
|
232 |
"Created: 16.4.1996 / 13:04:43 / cg"
|
|
233 |
! !
|
|
234 |
|
|
235 |
!JavaField methodsFor:'queries'!
|
|
236 |
|
|
237 |
initialValue
|
|
238 |
^ JavaClass initialValueFromSignature:signature
|
|
239 |
|
|
240 |
|
|
241 |
!
|
|
242 |
|
|
243 |
isFinal
|
|
244 |
^ (accessFlags bitAnd:A_FINAL) ~~ 0
|
|
245 |
|
|
246 |
"Modified: / 13.5.1998 / 12:59:26 / cg"
|
|
247 |
!
|
|
248 |
|
|
249 |
isPrivate
|
|
250 |
^ (accessFlags bitAnd:A_PRIVATE) ~~ 0
|
|
251 |
|
|
252 |
"Modified: / 13.5.1998 / 12:59:30 / cg"
|
|
253 |
!
|
|
254 |
|
|
255 |
isProtected
|
|
256 |
^ (accessFlags bitAnd:A_PROTECTED) ~~ 0
|
|
257 |
|
|
258 |
"Modified: / 13.5.1998 / 12:59:35 / cg"
|
|
259 |
!
|
|
260 |
|
|
261 |
isPublic
|
|
262 |
^ (accessFlags bitAnd:A_PUBLIC) ~~ 0
|
|
263 |
|
|
264 |
"Modified: / 13.5.1998 / 12:59:40 / cg"
|
|
265 |
!
|
|
266 |
|
|
267 |
isStatic
|
|
268 |
^ (accessFlags bitAnd:A_STATIC) ~~ 0
|
|
269 |
|
|
270 |
"Modified: / 13.5.1998 / 12:59:43 / cg"
|
|
271 |
!
|
|
272 |
|
|
273 |
isTransient
|
|
274 |
^ (accessFlags bitAnd:A_TRANSIENT) ~~ 0
|
|
275 |
|
|
276 |
"Modified: / 13.5.1998 / 12:59:51 / cg"
|
|
277 |
!
|
|
278 |
|
|
279 |
isVolatile
|
|
280 |
^ (accessFlags bitAnd:A_VOLATILE) ~~ 0
|
|
281 |
|
|
282 |
"Modified: / 13.5.1998 / 12:59:56 / cg"
|
|
283 |
!
|
|
284 |
|
|
285 |
type
|
|
286 |
^ JavaMethod typeFromSignature:signature in:nil
|
|
287 |
|
|
288 |
"Modified: / 8.1.1998 / 19:13:22 / cg"
|
|
289 |
!
|
|
290 |
|
|
291 |
typeClass
|
|
292 |
|
|
293 |
^(JavaDescriptor fromString: signature) javaClass.
|
|
294 |
|
|
295 |
"Created: / 23-11-2010 / 17:02:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
296 |
"Modified: / 25-11-2010 / 18:35:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
297 |
! !
|
|
298 |
|
|
299 |
!JavaField class methodsFor:'documentation'!
|
|
300 |
|
|
301 |
version
|
|
302 |
^ '$Id$'
|
|
303 |
!
|
|
304 |
|
|
305 |
version_CVS
|
|
306 |
^ '§Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaField.st,v 1.17 2009/10/09 14:04:34 cg Exp §'
|
|
307 |
!
|
|
308 |
|
|
309 |
version_SVN
|
|
310 |
^ '$Id$'
|
|
311 |
! !
|
|
312 |
|
|
313 |
JavaField initialize!
|