| Interface | Description |
|---|---|
| AnnotationVisitor |
Something that can visit annotation declarations.
|
| ClassFinder |
Finds (and optionally filters)
Class resources from ClassSpaces. |
| ClassSpace |
Represents an abstract collection of related classes and resources.
|
| ClassVisitor |
Something that can visit class definitions.
|
| QualifiedTypeListener |
Listens for types annotated with
Qualifier annotations. |
| SpaceModule.Strategy |
Visitor strategy.
|
| SpaceVisitor |
Something that can visit
ClassSpaces. |
| Class | Description |
|---|---|
| AbstractDeferredClass<T> |
Abstract combination of
DeferredClass and DeferredProvider. |
| AbstractSisuIndex |
Skeleton class that generates a qualified class index.
|
| BundleClassSpace |
ClassSpace backed by a strongly-referenced Bundle. |
| BundleClassSpace.ChainedEnumeration<T> |
Chains a series of
Enumerations together to look like a single Enumeration. |
| CloningClassSpace |
ClassSpace that can create multiple (deferred) copies of the same implementation type. |
| CloningClassSpace.CloningClassLoader |
ClassLoader that can define multiple copies of the same implementation type. |
| DefaultClassFinder |
ClassFinder that finds Class resources under a given package name. |
| FileEntryIterator |
Iterator that iterates over named entries beneath a file-system directory. |
| IndexedClassFinder |
ClassFinder that finds Class resources listed in the named index. |
| LoadedClass<T> |
Pseudo
DeferredClass backed by an already loaded Class. |
| MediationListener |
InjectionListener that listens for mediated watchers and registers them with the BeanLocator. |
| MediationListener.Mediation<Q extends java.lang.annotation.Annotation,T,W> |
Record containing all the necessary details about a mediated watcher.
|
| NamedClass<T> |
DeferredClass representing a named class from a ClassSpace. |
| QualifiedTypeBinder | |
| QualifiedTypeVisitor |
SpaceVisitor that reports types annotated with Qualifier annotations. |
| QualifierCache |
Caching
ClassVisitor that maintains a map of known Qualifier annotations. |
| ResourceEnumeration |
Enumeration of resources found by scanning JARs and directories. |
| ResourceEnumeration.NestedJarConnection |
Custom
URLConnection that can access JARs nested inside an arbitrary resource. |
| ResourceEnumeration.NestedJarHandler |
Custom
URLStreamHandler that can stream JARs nested inside an arbitrary resource. |
| SisuIndex |
Command-line utility that generates a qualified class index for a space-separated list of JARs.
|
| SisuIndexAPT6 |
Java 6 Annotation
Processor that generates a qualified class index for the current build. |
| SpaceModule |
Guice
Module that automatically binds types annotated with Qualifier annotations. |
| SpaceModule.RecordedElements | |
| SpaceScanner | |
| Streams |
Utility methods for dealing with streams.
|
| URLClassSpace | |
| WildcardKey |
Binding
Key for implementations that act as "wild-cards", meaning they match against any assignable type. |
| WildcardKey.QualifiedImpl |
Pseudo-
Annotation that can wrap any implementation type as a Qualifier. |
| ZipEntryIterator |
Iterator that iterates over named entries inside JAR or ZIP resources. |
| Enum | Description |
|---|---|
| BeanScanning |
Common techniques for discovering bean implementations.
|
| GlobberStrategy |
Enumerates various optimized filename globbing strategies.
|
| Annotation Type | Description |
|---|---|
| WildcardKey.Qualified |
Qualifier that captures a qualified implementation type. |
The SpaceModule should be given a ClassSpace representing the classes and resources to scan:
Guice.createInjector( new SpaceModule( new URLClassSpace( classloader ) ) );Reduce scanning time by using an
index or provide your own ClassFinder approach:
Guice.createInjector( new SpaceModule( new URLClassSpace( classloader ), BeanScanning.INDEX ) );
QualifiedTypeVisitor with QualifiedTypeBinder to find types annotated with @Named or other @Qualifiers and bind them as follows:
BeanLocator uses to check type compatibility at lookup time:
(This avoids the need to walk the type hierarchy and register bindings for each and every super-type, turning the injector graph to spaghetti.)
@Named("example") public class MyTypeImpl implements MyType {
// ...
}
If you use an empty @Named or a different @Qualifier annotation then Sisu will pick a canonical name based on the implementation type.
Sometimes you need explicit typed bindings for external integration; you can list the types in a @Typed annotation or leave it empty to use the declared interfaces:
@Named @Typed public class MyTypeImpl implements MyType {
// ...
}
Default implementations can be indicated by using "default" as a binding name:
@Named("default") public class MyTypeImpl implements MyType {
// ...
}
or by starting the implementation name with "Default":
@Named public class DefaultMyType implements MyType {
// ...
}
Default components are bound without a qualifier and have a higher ranking than non-default components.
@Named public class MyProvider implements Provider<MyType> {
public MyType get() {
// ...
}
}
Use @Singleton to scope the provided binding(s) as a singleton:
@Named @Singleton public class MyProvider implements Provider<MyType> {
public MyType get() {
// ...
}
}
Note: this is different to the normal Guice behaviour where singleton only applies to the provider itself.
@Named public class MyModule extends AbstractModule {
@Override protected void configure() {
// ...
}
}
Mediators are registered with the BeanLocator:
@Named public class MyMediator implements Mediator<Named, MyType, MyWatcher> {
public void add( BeanEntry<Named, MyType> entry, MyWatcher watcher ) throws Exception {
// ...
}
public void remove( BeanEntry<Named, MyType> entry, MyWatcher watcher ) throws Exception {
// ...
}
}