-
Notifications
You must be signed in to change notification settings - Fork 3
/
propertyaccessors.html
604 lines (421 loc) · 27.5 KB
/
propertyaccessors.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="generator" content="DITA-OT" /><meta name="DC.type" content="reference" />
<meta name="DC.title" content="Property Accessors" />
<meta name="abstract" content="" />
<meta name="description" content="" />
<meta name="DC.relation" scheme="URI" content="../reference/oqlsyntax.html" />
<meta name="copyright" content="Copyright (c) 2008, 2023 SAP AG and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at https://www.eclipse.org/legal/epl-2.0/ 2008 2023" type="primary" />
<meta name="DC.rights.owner" content="Copyright (c) 2008, 2023 SAP AG and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at https://www.eclipse.org/legal/epl-2.0/ 2008 2023" type="primary" />
<meta name="DC.format" content="XHTML" />
<meta name="DC.identifier" content="propertyaccessors" />
<meta name="DC.language" content="en-us" />
<link rel="stylesheet" type="text/css" href="../styles/commonltr.css" />
<title>Property Accessors</title>
</head>
<body id="propertyaccessors">
<h1 class="title topictitle1" id="ariaid-title1">Property Accessors</h1>
<div class="body refbody"><p class="shortdesc"></p>
<div class="section"><h2 class="title sectiontitle">Accessing fields of the heap object</h2>
<p class="p"> Properties of heap objects are accessed using a simple dot
notation:</p>
<p class="p"> [ <alias>. ] <field> . <field>.
<field>
</p>
<p class="p">
An
<strong class="ph b">alias</strong>
can be defined in the
<a class="xref" href="oqlsyntaxfrom.html">FROM Clause</a>
to identify the current object, i.e. row in the SQL
analogy, on which the OQL statement operates. Without
alias, the field is assumed to be one of the fields of
the current object.
<strong class="ph b">Fields</strong>
are attributes of the Java objects in the heap dump. Use
<a class="xref" href="tipsandtricks.html#oqlcompletion">OQL autocompletion</a>
or the
<span class="keyword cmdname">Object Inspector</span>
to find out about the available fields of an object.
</p>
</div>
<div class="section"><h2 class="title sectiontitle">Accessing Java Bean properties</h2>
<p class="p">[ <alias>. ] @<attribute> ...</p>
<p class="p">
Using the @ symbol, OQL accesses attributes of the
underlying Java objects used by Memory Analyzer to represent
objects in the heap dump. The attributes are resolved via
Bean Introspection. Use
<a class="xref" href="tipsandtricks.html#oqlcompletion">OQL autocompletion</a>
to find the common beans names.
The following table lists some
commonly used Java attributes.
</p>
<table cellpadding="4" cellspacing="0" summary="" id="propertyaccessors__javabean_prop" border="1" class="simpletable"><col style="width:22.22222222222222%" /><col style="width:22.22222222222222%" /><col style="width:22.22222222222222%" /><col style="width:33.33333333333333%" /><thead></thead><tbody><tr class="strow">
<td style="vertical-align:top;" class="stentry">Any heap object</td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IObject.html#method.summary">IObject</a></td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IObject.html#getObjectId()">objectId</a></td>
<td style="vertical-align:top;" class="stentry">id of snapshot object</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IObject.html#getObjectAddress()">objectAddress</a></td>
<td style="vertical-align:top;" class="stentry">address of snapshot object</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry">class</td>
<td style="vertical-align:top;" class="stentry">Java class of this object as a Memory Analyzer object</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IObject.html#getClazz()">clazz</a></td>
<td style="vertical-align:top;" class="stentry">IClass of this object. See also classof(object).</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IObject.html#getOutboundReferences()">outboundReferences</a></td>
<td style="vertical-align:top;" class="stentry">The outbound references as a list of
<a class="xref" href="../doc/org/eclipse/mat/snapshot/model/NamedReference.html">NamedReference</a> objects
from this object: the type as IClass of this object; the fields; the array entries.
This is retrieved from the heap dump, not an index, so could contain references
to unindexed objects.
</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IObject.html#getUsedHeapSize()">usedHeapSize</a></td>
<td style="vertical-align:top;" class="stentry">shallow heap size</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IObject.html#getRetainedHeapSize()">retainedHeapSize</a></td>
<td style="vertical-align:top;" class="stentry">retained heap size</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IObject.html#getTechnicalName()">technicalName</a></td>
<td style="vertical-align:top;" class="stentry">the technical name (a combination of the class name and the object address)</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IObject.html#getClassSpecificName()" target="_blank">classSpecificName</a></td>
<td style="vertical-align:top;" class="stentry">the value from a name resolver, if available, for example a readable value of a String</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IObject.html#getDisplayName()">displayName</a></td>
<td style="vertical-align:top;" class="stentry">display name, a combination of the technical name and the class specific name</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IObject.html#getSnapshot()">snapshot</a></td>
<td style="vertical-align:top;" class="stentry">the snapshot containing this object. An alternative to <code class="ph codeph">${snapshot}</code></td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry">Class object</td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IClass.html#method.summary">IClass</a></td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IClass.html#getClassLoaderId()">classLoaderId</a></td>
<td style="vertical-align:top;" class="stentry">id of the class loader</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry">Any array</td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IArray.html#method.summary">IArray</a></td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IArray.html#getLength()">length</a></td>
<td style="vertical-align:top;" class="stentry">length of the array</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry">Primitive array</td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IPrimitiveArray.html#method.summary">IPrimitiveArray</a></td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IPrimitiveArray.html#getValueArray()">valueArray</a></td>
<td style="vertical-align:top;" class="stentry">the values in the array</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry">Reference array</td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IObjectArray.html#method.summary">IObjectArray</a></td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IObjectArray.html#getReferenceArray()">referenceArray</a></td>
<td style="vertical-align:top;" class="stentry">the objects in the array (as long values, the addresses of the objects)
Access a particular element using get() and convert to an object using OBJECTS.
</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry">Class loader object</td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IClassLoader.html#method.summary">IClassLoader</a></td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IClassLoader.html#getClassLoaderId()">definedClasses</a></td>
<td style="vertical-align:top;" class="stentry">the classes defined by the class loader</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry">Object Reference</td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/ObjectReference.html#method.summary">ObjectReference</a></td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/ObjectReference.html#getObject()">object</a></td>
<td style="vertical-align:top;" class="stentry">The IObject which the reference points to</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/ObjectReference.html#getObjectId()">objectId</a></td>
<td style="vertical-align:top;" class="stentry">The id of the IObject which the reference points to. This will fail for unindexed objects.</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/ObjectReference.html#getObjectAddress()">objectAddress</a></td>
<td style="vertical-align:top;" class="stentry">The address of the IObject which the reference points to. This works for unindexed objects.</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry">Named Reference extends ObjectReference</td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/NamedReference.html#method.summary">NamedReference</a></td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/NamedReference.html#getName()">name</a></td>
<td style="vertical-align:top;" class="stentry">The field name or array index in the form <code class="ph codeph">[12357]</code> which describes the reference.</td>
</tr>
</tbody></table>
</div>
<div class="section"><h2 class="title sectiontitle">Calling Java methods</h2>
<pre class="pre codeblock"><code>[ <alias> . ] @<method>( [ <expression>, <expression> ] ) ...</code></pre>
<p class="p">
Adding ( ) forces OQL to interpret this as a Java method
call. The call is executed via reflection.
The code is executed inside Memory Analyzer on the objects in the snapshot
representing the heap dump. Code from the Java program which generated the dump is not
available and is not executed.
The following table lists some
common Java methods on the underlying Java objects used by Memory Analyzer to represent
objects in the heap dump.
</p>
<table cellpadding="4" cellspacing="0" summary="" id="propertyaccessors__method_prop" border="1" class="simpletable"><col style="width:22.22222222222222%" /><col style="width:22.22222222222222%" /><col style="width:22.22222222222222%" /><col style="width:33.33333333333333%" /><thead></thead><tbody><tr class="strow">
<td style="vertical-align:top;" class="stentry">${snapshot}</td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/ISnapshot.html#method.summary">ISnapshot</a></td>
<td style="vertical-align:top;" class="stentry">
<pre class="pre codeblock"><code><a class="xref" href="../doc/org/eclipse/mat/snapshot/ISnapshot.html#getClasses()">getClasses()</a></code></pre>
</td>
<td style="vertical-align:top;" class="stentry">a collection of all classes</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry">
<pre class="pre codeblock"><code><a class="xref" href="../doc/org/eclipse/mat/snapshot/ISnapshot.html#getClassesByName(java.util.regex.Pattern,%20boolean)">getClassesByName(String name, boolean includeSubClasses)</a></code></pre>
</td>
<td style="vertical-align:top;" class="stentry">a collection of classes</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry">Class object</td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IClass.html#method.summary">IClass</a></td>
<td style="vertical-align:top;" class="stentry">
<pre class="pre codeblock"><code><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IClass.html#hasSuperClass()">hasSuperClass()</a></code></pre>
</td>
<td style="vertical-align:top;" class="stentry">
result is true if the class has a super class
</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry"> </td>
<td style="vertical-align:top;" class="stentry">
<pre class="pre codeblock"><code><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IClass.html#isArrayType()">isArrayType()</a></code></pre>
</td>
<td style="vertical-align:top;" class="stentry">
the result is true if the class is an array type
</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry">Any heap object</td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IObject.html#method.summary">IObject</a></td>
<td style="vertical-align:top;" class="stentry">
<pre class="pre codeblock"><code><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IObject.html#getObjectAddress()">getObjectAddress()</a></code></pre>
</td>
<td style="vertical-align:top;" class="stentry">
The address of a snapshot object as a long integer
</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry">Primitive array</td>
<td style="vertical-align:top;" class="stentry"><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IPrimitiveArray.html#method.summary">IPrimitiveArray</a></td>
<td style="vertical-align:top;" class="stentry">
<pre class="pre codeblock"><code><a class="xref" href="../doc/org/eclipse/mat/snapshot/model/IPrimitiveArray.html#getValueAt(int)">getValueAt(int index)</a></code></pre>
</td>
<td style="vertical-align:top;" class="stentry">a value from the array</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry">Java primitive array, Java object array or Java list (returned from reflection)</td>
<td style="vertical-align:top;" class="stentry">[] or List</td>
<td style="vertical-align:top;" class="stentry">
<pre class="pre codeblock"><code>get(int index)</code></pre>
</td>
<td style="vertical-align:top;" class="stentry">a value from the array or list</td>
</tr>
</tbody></table>
</div>
<div class="section"><h2 class="title sectiontitle">Array Access</h2>
<p class="p">Memory Analyzer 1.3 or later allows direct array style access of
primitive arrays and objects arrays from the snapshot, and Java arrays and Java Lists
obtained from reflective method calls. The notation is <code class="ph codeph">[index]</code>.
The index is a zero-based integer. If the array is null or the index is out of range
then the result is null.
</p>
<p class="p">Memory Analyzer 1.4 or later allows array range access as well using the notation
<code class="ph codeph">[index1:index2]</code> where index1 and index2 are inclusive. If the values
are negative then they are treated as indexing from the end of the array, so -1
means the last entry. This means the whole array can be accessed as a list as
<code class="ph codeph">[0:-1]</code>.
</p>
</div>
<div class="section"><h2 class="title sectiontitle">Reading values from primitive arrays (from the heap dump)</h2>
<pre class="pre codeblock"><code>SELECT s[2] FROM int[] s WHERE (s.@length > 2)</code></pre>
<p class="p">This method is for Memory Analyzer 1.3 or later.</p>
<pre class="pre codeblock"><code>SELECT s.getValueAt(2) FROM int[] s WHERE (s.@length > 2)</code></pre>
<p class="p">This method is for all versions of Memory Analyzer.
This reads the value of the element at index 2 from all int[] arrays which have at least 3 elements.
</p>
</div>
<div class="section"><h2 class="title sectiontitle">Reading objects from object arrays (from the heap dump)</h2>
<pre class="pre codeblock"><code>SELECT s[2] FROM java.lang.Object[] s WHERE (s.@length > 2)</code></pre>
<p class="p">This method is for Memory Analyzer 1.3 or later.
<code class="ph codeph">s[2]</code>is an IObject so fields and Java bean properties can be accessed</p>
<pre class="pre codeblock"><code>SELECT OBJECTS s[2] FROM java.lang.Object[] s</code></pre>
<p class="p">This method is for Memory Analyzer 1.3 or later.
The <span class="keyword">OBJECTS</span> converts the object to give a tree view rather than
table result. We do not need the <span class="keyword">WHERE</span> clause as out of range
accesses return null and the <span class="keyword">OBJECTS</span> skips nulls.</p>
<pre class="pre codeblock"><code>SELECT OBJECTS s.@referenceArray.get(2) FROM java.lang.Object[] s WHERE (s.@length > 2)</code></pre>
<p class="p">This method is for Memory Analyzer 1.1 or later.
This reads as a long address the element at index 2 from all Object[] arrays which have at least 3 elements and
converts them into objects.
</p>
<pre class="pre codeblock"><code>SELECT OBJECTS s.getReferenceArray(2,1) FROM java.lang.Object[] s WHERE (s.@length > 2)</code></pre>
<p class="p">This method is for Memory Analyzer 1.1 or later.
This reads as an array of long[] 1 element starting at index 2 from all Object[] arrays which have at least 3 elements and
converts the contents of those arrays into objects.
</p>
</div>
<div class="section"><h2 class="title sectiontitle">Reading from Java arrays (Memory Analyzer internal objects)</h2>
<pre class="pre codeblock"><code>SELECT s.@GCRoots[2] FROM OBJECTS ${snapshot} s</code></pre>
<p class="p">This method is for Memory Analyzer 1.3 or later.</p>
<pre class="pre codeblock"><code>SELECT s.get(2) FROM OBJECTS ${snapshot} s WHERE s.@GCRoots.@length > 2</code></pre>
<p class="p">This method is for all versions of Memory Analyzer.</p>
</div>
<div class="section"><h2 class="title sectiontitle">Reading from Java Lists (Memory Analyzer internal objects)</h2>
<pre class="pre codeblock"><code>SELECT s.@GCRoots.subList(1,3)[1] FROM OBJECTS ${snapshot} s</code></pre>
<p class="p">This method is for Memory Analyzer 1.3 or later.</p>
<pre class="pre codeblock"><code>SELECT s.@GCRoots.subList(1,3).get(1) FROM OBJECTS ${snapshot} s</code></pre>
<p class="p">This method is for all versions of Memory Analyzer.</p>
</div>
<div class="section"><h2 class="title sectiontitle">Reading subarrays</h2>
<pre class="pre codeblock"><code>SELECT s, s.count, s.offset, s.value[s.offset],
s.value[s.offset:((s.offset + s.count) - 1)],
s.value[s.offset:((s.offset + 0) - 1)],
s.value[0:-1].subList(s.offset,(s.offset + 0)),
s.value[s.offset:-1].subList(0,s.count)
FROM java.lang.String s</code></pre>
<p class="p">This method is for Memory Analyzer 1.4 or later.</p>
<p class="p">This shows how the whole array can be converted to a list using <code class="ph codeph">[0:-1]</code> and
that how using array range <code class="ph codeph">[offset:offset+count-1]</code> gives perhaps unexpected results
when <code class="ph codeph">offset=0</code> and <code class="ph codeph">count=0</code> as instead of an empty list it gives the whole array.
Using <code class="ph codeph">subList(offset,offet+count)</code> once the whole array has been converted to a list
gives the expected result.
</p>
</div>
<div class="section"><h2 class="title sectiontitle">Collection access</h2>
<pre class="pre codeblock"><code>SELECT a[0] FROM java.util.ArrayList a</code></pre>
<p class="p">Many of the standard collections classes are well known by Memory Analyzer.
The <a class="xref" href="../tasks/analyzingjavacollectionusage.html">collection queries</a>
allow analysis of lists, sets, queues, deques and maps.
This access is extended to OQL so if the collection queries work with a particular
collection or map then so does OQL.
</p>
<div class="note"><span class="notetitle">Note:</span> Collection and map access is still experimental and subject to change.</div>
<pre class="pre codeblock"><code>SELECT a[0:-1] FROM java.util.ArrayList a</code></pre>
<p class="p">If the array access syntax is used on a collection (list,set, queue, deque) object
then particular elements of the collection can be extracted. If subarray syntax
is used then that part of collection is converted to a list ready for further processing</p>
<pre class="pre codeblock"><code>SELECT h[0].@key, h[0].@value FROM java.util.HashMap h</code></pre>
<p class="p">If the array access syntax is used on a map then the map is converted to a list of
map entries. These can then be examined using the bean access syntax to retrieve the key
<code class="ph codeph">h[0].@key</code> or value <code class="ph codeph">h[0].@value</code>.
See <a class="xref" href="https://wiki.eclipse.org/MemoryAnalyzer/OQL#Map_processing">Wiki OQL Map processing</a>
for more details of OQL with maps and collections.</p>
</div>
<div class="section"><h2 class="title sectiontitle">Built-in OQL functions</h2>
<pre class="pre codeblock"><code><function>( <parameter> )</code></pre>
<p class="p">Built-in functions.</p>
<table cellpadding="4" cellspacing="0" summary="" id="propertyaccessors__oql_functions" border="1" class="simpletable"><col style="width:40%" /><col style="width:60%" /><thead></thead><tbody><tr class="strow">
<td style="vertical-align:top;" class="stentry">
<pre class="pre codeblock"><code>toHex( number )</code></pre>
</td>
<td style="vertical-align:top;" class="stentry">Print the number as hexadecimal</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry">
<pre class="pre codeblock"><code>toString( object )</code></pre>
</td>
<td style="vertical-align:top;" class="stentry">
Returns the value of an object, e.g. the content
of a String etc.
</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry">
<pre class="pre codeblock"><code>dominators( object )</code></pre>
</td>
<td style="vertical-align:top;" class="stentry">
The objects immediately dominated by the object
</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry">
<pre class="pre codeblock"><code>outbounds( object )</code></pre>
</td>
<td style="vertical-align:top;" class="stentry">outbound referrer</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry">
<pre class="pre codeblock"><code>inbounds( object )</code></pre>
</td>
<td style="vertical-align:top;" class="stentry">inbound referrer</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry">
<pre class="pre codeblock"><code>classof( object )</code></pre>
</td>
<td style="vertical-align:top;" class="stentry">the class of the current object</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry">
<pre class="pre codeblock"><code>dominatorof( object )</code></pre>
</td>
<td style="vertical-align:top;" class="stentry">
the immediate dominator, -1 if none
</td>
</tr>
<tr class="strow">
<td style="vertical-align:top;" class="stentry">
<pre class="pre codeblock"><code>eval( expression )</code></pre>
</td>
<td style="vertical-align:top;" class="stentry">
(Experimental in Memory Analyzer 1.4 or later) evaluates the argument and returns it.
Could be useful to allow array/method access to the result of a sub-select or
expression.
</td>
</tr>
</tbody></table>
</div>
</div>
<div class="related-links">
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a class="link" href="../reference/oqlsyntax.html">OQL Syntax</a></div>
</div>
</div></body>
</html>