Annotation Interface Wire


Used on a module to specify an explicit wire directive when multiple matches are found during the auto-wiring process for instance.

The Inverno compiler will fail it finds multiple beans matching a single socket, the Wire annotation is then used on a the module to explicitly tell the compiler which bean has to be injected in a particular socket.

A Wire annotation can also be used to explicitly specify which beans must be injected in a multiple socket like list or arrays.

Since:
1.0
Author:
Jeremy Kuhn
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Indicates the names of the beans to wire.
    Indicates the socket where to inject the beans.
  • Element Details

    • beans

      String[] beans

      Indicates the names of the beans to wire.

      A bean's name can be fully qualified (eg. [MODULE_NAME]:[BEAN_NAME]) to refer to a bean provided by an external module or simple to refer to a bean inside the current module (eg. [BEAN_NAME]).

      Returns:
      A list of beans
    • into

      String into

      Indicates the socket where to inject the beans.

      A socket name can be of three forms evaluated in this order:

      • [MODULE_NAME]:[BEAN_NAME]:[SOCKET_NAME]
      • [BEAN_NAME]:[SOCKET_NAME] where the module is implicitly the current module
      • [MODULE_NAME]:[SOCKET_NAME] to refer to a module socket.

      Hopefully the Inverno compiler doesn't let you define a bean with the same name as a required module which prevents conflicts between the last two identifiers.

      Returns:
      A socket