Interface ObserverInfo


  • public interface ObserverInfo
    Observers are:
    • observer methods
    • synthetic observers
    Observer methods directly correspond to a method declaration in program source code. Synthetic observers don't and are instead defined through other mechanisms, such as extensions.
    Since:
    4.0
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      BeanInfo bean()
      Returns the bean that declares this observer method.
      jakarta.enterprise.lang.model.declarations.ClassInfo declaringClass()
      Returns the class that declares this observer.
      jakarta.enterprise.lang.model.declarations.ParameterInfo eventParameter()
      Returns the event parameter of this observer method.
      jakarta.enterprise.lang.model.types.Type eventType()
      Returns the observed event type of this observer.
      boolean isAsync()
      Returns whether this observer is asynchronous.
      boolean isSynthetic()
      Returns whether this observer is synthetic.
      jakarta.enterprise.lang.model.declarations.MethodInfo observerMethod()
      Returns the declaration of this observer method.
      int priority()
      Returns the priority of this observer.
      java.util.Collection<jakarta.enterprise.lang.model.AnnotationInfo> qualifiers()
      Returns a collection of observed event qualifiers, represented as AnnotationInfo.
      Reception reception()
      Returns the reception type of this observer.
      TransactionPhase transactionPhase()
      Returns the transaction phase of this transactional observer.
    • Method Detail

      • eventType

        jakarta.enterprise.lang.model.types.Type eventType()
        Returns the observed event type of this observer.
        Returns:
        the observed event type of this observer, never null
      • qualifiers

        java.util.Collection<jakarta.enterprise.lang.model.AnnotationInfo> qualifiers()
        Returns a collection of observed event qualifiers, represented as AnnotationInfo.
        Returns:
        immutable collection of observed event qualifiers, never null
      • declaringClass

        jakarta.enterprise.lang.model.declarations.ClassInfo declaringClass()
        Returns the class that declares this observer. In case of synthetic observers, returns the class that was designated as a declaring class during synthetic observer registration.
        Returns:
        the class that declares this observer, never null
      • observerMethod

        jakarta.enterprise.lang.model.declarations.MethodInfo observerMethod()
        Returns the declaration of this observer method. Returns null if this is a synthetic observer.
        Returns:
        this observer method, or null if this is a synthetic observer
      • eventParameter

        jakarta.enterprise.lang.model.declarations.ParameterInfo eventParameter()
        Returns the event parameter of this observer method. Returns null if this is a synthetic observer.
        Returns:
        the event parameter of this observer method, or null if this is a synthetic observer
      • bean

        BeanInfo bean()
        Returns the bean that declares this observer method. Returns null if this is a synthetic observer.
        Returns:
        the bean declaring this observer method, or null if this is a synthetic observer
      • isSynthetic

        boolean isSynthetic()
        Returns whether this observer is synthetic.
        Returns:
        whether this observer is synthetic
      • priority

        int priority()
        Returns the priority of this observer. This is typically defined by adding the @Priority annotation to the event parameter of the observer method. If the annotation is not used, the default priority, as defined by the CDI specification, is returned,
        Returns:
        the priority of this observer
      • isAsync

        boolean isAsync()
        Returns whether this observer is asynchronous. For observer methods, this means whether this observer method uses @ObservesAsync.
        Returns:
        whether this observer is asynchronous
      • reception

        Reception reception()
        Returns the reception type of this observer. Allows distinguishing conditional observer methods from always notified observer methods. Returns Reception.ALWAYS if this is a synthetic observer.
        Returns:
        the reception type of this observer, never null
      • transactionPhase

        TransactionPhase transactionPhase()
        Returns the transaction phase of this transactional observer. Returns TransactionPhase.IN_PROGRESS if this is a regular synchronous observer. Returns null if this is an asynchronous observer.
        Returns:
        the transaction phase of this observer, or null if this is an asynchronous observer