Module jdk.jfr
Package jdk.jfr

Annotation Interface BooleanFlag

@Retention(RUNTIME) @Target({FIELD,TYPE,METHOD}) public @interface BooleanFlag
Event field annotation, specifies that the value is a boolean flag, a true or false value.

The following example shows how the BooleanFlag annotation can be used to describe that a setting is a boolean value. This information can be used by a graphical user interface to display the setting as a checkbox.

@Description("Include transactions that are rollbacked")
public static class RollbackSetting extends SettingControl {
    private boolean value = true;

    public String combine(Set<String> values) {
        return values.contains("true") ? "true" : "false";

    public void setValue(String settingValue) {
        value = "true".equals(settingValue);

    public String getValue() {
        return Boolean.toString(value);

    public boolean shouldEmit() {
        return value;

public static class TransactionEvent extends Event {
    String context;

    boolean rollback;

    public boolean rollback(RollbackSetting rollbackSetting) {
        return rollback && rollbackSetting.shouldEmit();