50113
|
1 |
/*
|
58863
|
2 |
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
50113
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
|
10 |
*
|
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
* accompanied this code).
|
|
16 |
*
|
|
17 |
* You should have received a copy of the GNU General Public License version
|
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
*
|
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
22 |
* or visit www.oracle.com if you need additional information or have any
|
|
23 |
* questions.
|
|
24 |
*/
|
|
25 |
|
|
26 |
package jdk.jfr.consumer;
|
|
27 |
|
|
28 |
import java.lang.reflect.Modifier;
|
|
29 |
|
58863
|
30 |
import jdk.jfr.internal.consumer.ObjectContext;
|
50113
|
31 |
|
|
32 |
/**
|
|
33 |
* A recorded method.
|
|
34 |
*
|
|
35 |
* @since 9
|
|
36 |
*/
|
|
37 |
public final class RecordedMethod extends RecordedObject {
|
|
38 |
|
58863
|
39 |
// package private
|
|
40 |
RecordedMethod(ObjectContext objectContext, Object[] values) {
|
|
41 |
super(objectContext, values);
|
50113
|
42 |
}
|
|
43 |
|
|
44 |
/**
|
|
45 |
* Returns the class this method belongs to, if it belong to a Java frame.
|
|
46 |
* <p>
|
|
47 |
* To ensure this is a Java frame, use the {@link RecordedFrame#isJavaFrame()}
|
|
48 |
* method.
|
|
49 |
*
|
|
50 |
* @return the class, may be {@code null} if not a Java frame
|
|
51 |
*
|
|
52 |
* @see RecordedFrame#isJavaFrame()
|
|
53 |
*/
|
|
54 |
public RecordedClass getType() {
|
|
55 |
return getTyped("type", RecordedClass.class, null);
|
|
56 |
}
|
|
57 |
|
|
58 |
/**
|
|
59 |
* Returns the name of this method, for example {@code "toString"}.
|
|
60 |
* <p>
|
|
61 |
* If this method doesn't belong to a Java frame the result is undefined.
|
|
62 |
*
|
|
63 |
* @return method name, or {@code null} if doesn't exist
|
|
64 |
*
|
|
65 |
* @see RecordedFrame#isJavaFrame()
|
|
66 |
*/
|
|
67 |
public String getName() {
|
|
68 |
return getTyped("name", String.class, null);
|
|
69 |
}
|
|
70 |
|
|
71 |
/**
|
|
72 |
* Returns the method descriptor for this method (for example,
|
|
73 |
* {@code "(Ljava/lang/String;)V"}).
|
|
74 |
* <p>
|
|
75 |
* See Java Virtual Machine Specification, 4.3
|
|
76 |
* <p>
|
|
77 |
* If this method doesn't belong to a Java frame then the the result is undefined.
|
|
78 |
*
|
|
79 |
* @return method descriptor.
|
|
80 |
*
|
|
81 |
* @see RecordedFrame#isJavaFrame()
|
|
82 |
*/
|
|
83 |
public String getDescriptor() {
|
|
84 |
return getTyped("descriptor", String.class, null);
|
|
85 |
}
|
|
86 |
|
|
87 |
/**
|
|
88 |
* Returns the modifiers for this method.
|
|
89 |
* <p>
|
|
90 |
* If this method doesn't belong to a Java frame, then the result is undefined.
|
|
91 |
*
|
|
92 |
* @return the modifiers
|
|
93 |
*
|
|
94 |
* @see Modifier
|
|
95 |
* @see RecordedFrame#isJavaFrame
|
|
96 |
*/
|
|
97 |
public int getModifiers() {
|
|
98 |
return getTyped("modifiers", Integer.class, Integer.valueOf(0));
|
|
99 |
}
|
|
100 |
|
|
101 |
/**
|
|
102 |
* Returns whether this method is hidden (for example, wrapper code in a lambda
|
|
103 |
* expressions).
|
|
104 |
*
|
|
105 |
* @return {@code true} if method is hidden, {@code false} otherwise
|
|
106 |
*/
|
|
107 |
public boolean isHidden() {
|
|
108 |
return getTyped("hidden", Boolean.class, Boolean.FALSE);
|
|
109 |
}
|
|
110 |
}
|