Annotation Interface Signal


@Retention(RUNTIME) @Target(TYPE) public @interface Signal
Register the annotated type as a GObject signal on the enclosing class.

The signal declaration must be a functional interface. Example usage:


public class Example extends GObject {
    @Signal
    public interface ExampleSignal {
        public boolean run();
    }
}
Alternatively, extend an existing functional interface:

public class Example extends GObject {
    @Signal
    public interface ExampleSignal extends BooleanSupplier {};
}
When the enclosing class is registered as a GObject using Types#register(), the signal will be registered for that class, using the parameters of the annotated type.

The default name of the signal is derived from the type name, translating camel-case ("ExampleSignal") to kebab-case ("example-signal"). It is possible to override this with the name() parameter.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Action signals are signals that may freely be emitted on alive objects from user code via g_signal_emit() and friends, without the need of being embedded into extra code that performs pre or post emission adjustments on the object.
    boolean
    The signal is deprecated and will be removed in a future version.
    boolean
    This signal supports “::detail” appendices to the signal name upon handler connections and emissions.
    boolean
    Varargs signal emission will always collect the arguments, even if there are no signal handlers connected.
    The name of the signal.
    boolean
    No emissions hooks are supported for this signal.
    boolean
    Signals being emitted for an object while currently being in emission for this very object will not be emitted recursively, but instead cause the first emission to be restarted.
    boolean
    Invoke the object method handler in the last emission stage.
    boolean
    Invoke the object method handler in the first emission stage.
    boolean
    Invoke the object method handler in the third emission stage.
  • Element Details

    • name

      String name
      The name of the signal. The default name is translated from the type name.
      Default:
      ""
    • runFirst

      boolean runFirst
      Invoke the object method handler in the first emission stage.
      Default:
      false
    • runLast

      boolean runLast
      Invoke the object method handler in the third emission stage.
      Default:
      false
    • runCleanup

      boolean runCleanup
      Invoke the object method handler in the last emission stage.
      Default:
      false
    • noRecurse

      boolean noRecurse
      Signals being emitted for an object while currently being in emission for this very object will not be emitted recursively, but instead cause the first emission to be restarted.
      Default:
      false
    • detailed

      boolean detailed
      This signal supports “::detail” appendices to the signal name upon handler connections and emissions.
      Default:
      false
    • action

      boolean action
      Action signals are signals that may freely be emitted on alive objects from user code via g_signal_emit() and friends, without the need of being embedded into extra code that performs pre or post emission adjustments on the object. They can also be thought of as object methods which can be called generically by third-party code.
      Default:
      false
    • noHooks

      boolean noHooks
      No emissions hooks are supported for this signal.
      Default:
      false
    • mustCollect

      boolean mustCollect
      Varargs signal emission will always collect the arguments, even if there are no signal handlers connected.
      Since:
      2.30
      Default:
      false
    • deprecated

      boolean deprecated
      The signal is deprecated and will be removed in a future version. A warning will be generated if it is connected while running with G_ENABLE_DIAGNOSTIC=1.
      Since:
      2.32
      Default:
      false