|
1 /* |
|
2 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. |
|
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 package jdk.jfr; |
|
26 |
|
27 import java.lang.annotation.ElementType; |
|
28 import java.lang.annotation.Retention; |
|
29 import java.lang.annotation.RetentionPolicy; |
|
30 import java.lang.annotation.Target; |
|
31 |
|
32 /** |
|
33 * Annotation that specifies that a method in an event class should be used to |
|
34 * filter out events. |
|
35 * <p> |
|
36 * For the method to be valid it must return a {@code SettingControl} and only have one |
|
37 * parameter, which should be a non-abstract subclass of {@link SettingControl} |
|
38 * <p> |
|
39 * The return value of the method specifies whether the event is to be |
|
40 * written to the Flight Recorder system or not. |
|
41 * <p> |
|
42 * The following example shows how to annotate a method in an event class. |
|
43 * |
|
44 * <pre> |
|
45 * <code> |
|
46 * class HelloWorld extend Event { |
|
47 * |
|
48 * {@literal @}Label("Message"); |
|
49 * String message; |
|
50 * |
|
51 * {@literal @}SettingDefinition; |
|
52 * {@literal @}Label("Message Filter"); |
|
53 * public boolean filter(RegExpControl regExp) { |
|
54 * return regExp.matches(message); |
|
55 * } |
|
56 * } |
|
57 * </code> |
|
58 * </pre> |
|
59 * |
|
60 * For an example of how the setting controls are defined, see |
|
61 * {@link SettingControl}. |
|
62 * |
|
63 * @see SettingControl |
|
64 * |
|
65 * @since 9 |
|
66 */ |
|
67 @Retention(RetentionPolicy.RUNTIME) |
|
68 @Target({ ElementType.METHOD }) |
|
69 public @interface SettingDefinition { |
|
70 } |