Injectable API for Sisu components (a.k.a beans).
Interfaces
BeanEntry<Q extends Annotation, T> |
Describes Qualified bean implementations of T:
@Inject
Iterable<BeanEntry<Named, Command>> commands;
Use this when you want to know more about available beans; especially if you want to avoid creating instances. |
Mediator<Q extends Annotation, T, W> |
Watches for Qualified bean implementations of T:
// add @Named for automatic registration
public class MyMediator
implements Mediator<Named, MyType, MyWatcher>
{
public void add( BeanEntry<Named, MyType> entry, MyWatcher watcher )
throws Exception
{
// translate event to whatever the watcher expects
}
public void remove( BeanEntry<Named, MyType> entry, MyWatcher watcher )
throws Exception
{
// translate event to whatever the watcher expects
}
}
Mediator implementations must have a public no-arg constructor; they are neither injected nor injectable, acting
instead as stateless translators. |
Annotations
Description |
Describes a bean:
@Named
@Description( "Summarizes system status" )
public class SystemStatus
{
//
}
|
Dynamic |
Marks dependencies that should be dynamic proxies:
@Inject
@Dynamic
Component proxy;
|
EagerSingleton |
Marks beans that should be created as soon as possible:
@Named
@EagerSingleton
public class Startup
{
//
}
|
Hidden |
Hides a bean from being located or watched:
@Named
@Hidden
public class InternalComponent
{
//
}
|
Nullable |
Marks dependencies that can be null :
@Inject
@Nullable
Component optional;
|
Parameters |
Qualifier of application parameters:
@Inject
@Parameters
String[] args;
@Inject
@Parameters
Map<?, ?> properties;
This qualifier marks collections of values that act as overall application parameters, like the String[]
argument array passed into the main method or the Map of system properties. |
Priority |
Defines the priority ordering of a bean, higher values have higher priority:
@Named
@Priority( 999 )
public class ImportantComponent
{
//
}
Implicit priorities start at zero for default beans, negative for non-default. |
Typed |
Restricts the visible types of a bean:
@Named
@Typed( Widget.class, Service.class )
public class PrinterWidget
extends AbstractWidget
implements Service
{
//
}
|