Package org.eclipse.sisu.launch
Class SisuExtensions
- java.lang.Object
-
- org.eclipse.sisu.launch.SisuExtensions
-
- All Implemented Interfaces:
SpaceModule.Strategy
,WireModule.Strategy
public final class SisuExtensions extends Object implements SpaceModule.Strategy, WireModule.Strategy
SPI mechanism for discoveringModule
andStrategy
extensions.
-
-
Field Summary
-
Fields inherited from interface org.eclipse.sisu.space.SpaceModule.Strategy
DEFAULT, DEFAULT_STRICT
-
Fields inherited from interface org.eclipse.sisu.wire.WireModule.Strategy
DEFAULT
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> List<T>
create(Class<T> spi)
Creates instances of extensions listed underMETA-INF/services/ fully-qualified-SPI-name
; implementations must have a public no-arg constructor.<T,C>
List<T>create(Class<T> spi, Class<C> contextType, C context)
Creates instances of extensions listed underMETA-INF/services/ fully-qualified-SPI-name
; implementations must either have a public no-arg constructor or one with the declared context type.static SisuExtensions
global(ClassSpace space)
Returns globalSisuExtensions
from the surrounding class space.void
install(com.google.inject.Binder binder)
Installs modules listed underMETA-INF/services/com.google.inject.Module
; modules must have a public no-arg constructor.<C> void
install(com.google.inject.Binder binder, Class<C> contextType, C context)
Installs modules listed underMETA-INF/services/com.google.inject.Module
; modules must either have a public no-arg constructor or one with the declared context type.<T> List<Class<? extends T>>
load(Class<T> spi)
Loads extension types listed underMETA-INF/services/ fully-qualified-SPI-name
.static SisuExtensions
local(ClassSpace space)
Returns localSisuExtensions
from the containing class space.SpaceVisitor
visitor(com.google.inject.Binder binder)
SpaceModule
strategy that letsMETA-INF/services/org.eclipse.sisu.space.SpaceVisitor
extensions override the default scanning.Wiring
wiring(com.google.inject.Binder binder)
WireModule
strategy that letsMETA-INF/services/org.eclipse.sisu.wire.Wiring
extensions override the default wiring.
-
-
-
Method Detail
-
local
public static SisuExtensions local(ClassSpace space)
Returns localSisuExtensions
from the containing class space.- Parameters:
space
- The class space- Returns:
- Local extensions
-
global
public static SisuExtensions global(ClassSpace space)
Returns globalSisuExtensions
from the surrounding class space.- Parameters:
space
- The class space- Returns:
- Global extensions
-
install
public void install(com.google.inject.Binder binder)
Installs modules listed underMETA-INF/services/com.google.inject.Module
; modules must have a public no-arg constructor.- Parameters:
binder
- The current binder
-
install
public <C> void install(com.google.inject.Binder binder, Class<C> contextType, C context)
Installs modules listed underMETA-INF/services/com.google.inject.Module
; modules must either have a public no-arg constructor or one with the declared context type.- Parameters:
binder
- The current bindercontextType
- Optional context typecontext
- Optional context instance
-
wiring
public Wiring wiring(com.google.inject.Binder binder)
WireModule
strategy that letsMETA-INF/services/org.eclipse.sisu.wire.Wiring
extensions override the default wiring.- Specified by:
wiring
in interfaceWireModule.Strategy
- Parameters:
binder
- The binder- Returns:
- Extended wiring
-
visitor
public SpaceVisitor visitor(com.google.inject.Binder binder)
SpaceModule
strategy that letsMETA-INF/services/org.eclipse.sisu.space.SpaceVisitor
extensions override the default scanning.- Specified by:
visitor
in interfaceSpaceModule.Strategy
- Parameters:
binder
- The binder- Returns:
- Extended visitor
-
create
public <T> List<T> create(Class<T> spi)
Creates instances of extensions listed underMETA-INF/services/ fully-qualified-SPI-name
; implementations must have a public no-arg constructor.- Parameters:
spi
- The extension SPI- Returns:
- List of extensions
-
create
public <T,C> List<T> create(Class<T> spi, Class<C> contextType, C context)
Creates instances of extensions listed underMETA-INF/services/ fully-qualified-SPI-name
; implementations must either have a public no-arg constructor or one with the declared context type.- Parameters:
spi
- The extension SPIcontextType
- Optional context typecontext
- Optional context instance- Returns:
- List of extensions
-
-