Interface SyntheticComponents


public interface SyntheticComponents
Allows registering synthetic beans and observers.
Since:
4.0
  • Method Details

    • addBean

      <T> SyntheticBeanBuilder<T> addBean(Class<T> implementationClass)
      Creates a SyntheticBeanBuilder that allows configuring a new synthetic bean of given implementationClass. The synthetic bean will be registered at the end of the @Synthesis method.
      Type Parameters:
      T - the implementation class of the new synthetic bean
      Parameters:
      implementationClass - the implementation class of the new synthetic bean, must not be null
      Returns:
      a new SyntheticBeanBuilder, never null
    • addObserver

      <T> SyntheticObserverBuilder<T> addObserver(Class<T> eventType)
      Creates a SyntheticObserverBuilder that allows configuring a new synthetic observer for given eventType. The synthetic observer will be registered at the end of the @Synthesis method.
      Type Parameters:
      T - the observed event type of the new synthetic observer
      Parameters:
      eventType - the observed event type of the new synthetic observer, must not be null
      Returns:
      a new SyntheticObserverBuilder, never null
    • addObserver

      <T> SyntheticObserverBuilder<T> addObserver(Type eventType)
      Creates a SyntheticObserverBuilder that allows configuring a new synthetic observer for given eventType. The synthetic observer will be registered at the end of the @Synthesis method.

      This method is supposed to be called with explicitly provided type arguments. For example, to define a synthetic observer of event type List<String>, one would call:

      
       // types is of type Types
       // syntheticComponents is of type SyntheticComponents
       syntheticComponents.<List<String>>addObserver(types.parameterized(List.class, String.class))
           ...
       
      Type Parameters:
      T - the observed event type of the new synthetic observer
      Parameters:
      eventType - the observed event type of the new synthetic observer, must not be null
      Returns:
      a new SyntheticObserverBuilder, never null