public abstract class SourceI
extends java.lang.Object
SourceType annotation.
These sources are instantiated by passing the annotation scanned at runtime into a constructor
for the class specified by the SourceType annotation.
For example, if a class is annotated by @Queue("test"), passing that class into
SourceUtil.getSources(Class), will return a Stream containing
a QueueSource with a name of "test". This is done with
the following process:
queue annotation,
it will see that annotation is annotated with @SourceType(QueueSource.class). This
will cause a new QueueSource to be created using the
QueueSource.QueueSource(forklift.source.decorators.Queue)
constructor.This class also provides a limited form of case handling for sources, so that one source can be handled only for a few particular cases, in way that is somewhat similar to pattern matching case classes in scala.
SourceUtil| Modifier and Type | Class and Description |
|---|---|
static interface |
SourceI.ExceptionalConsumer<I,E extends java.lang.Throwable> |
static interface |
SourceI.ExceptionalFunction<I,O,E extends java.lang.Throwable> |
static class |
SourceI.SourceIHandler<OUT> |
| Constructor and Description |
|---|
SourceI() |
| Modifier and Type | Method and Description |
|---|---|
<SOURCE extends SourceI,EX extends java.lang.Throwable> |
accept(java.lang.Class<SOURCE> sourceType,
SourceI.ExceptionalConsumer<SOURCE,EX> action) |
<SOURCE extends SourceI,OUT,EX extends java.lang.Throwable> |
apply(java.lang.Class<SOURCE> sourceType,
SourceI.ExceptionalFunction<SOURCE,OUT,EX> action) |
java.lang.Class<?> |
getContextClass() |
abstract boolean |
isLogicalSource() |
protected void |
onContextSet()
This method should be overriden to initialize any state that depends on the class-based context for the source
|
void |
setContextClass(java.lang.Class<?> contextClass) |
public void setContextClass(java.lang.Class<?> contextClass)
public java.lang.Class<?> getContextClass()
protected void onContextSet()
public abstract boolean isLogicalSource()
public <SOURCE extends SourceI,OUT,EX extends java.lang.Throwable> SourceI.SourceIHandler<OUT> apply(java.lang.Class<SOURCE> sourceType, SourceI.ExceptionalFunction<SOURCE,OUT,EX> action) throws EX extends java.lang.Throwable
EX extends java.lang.Throwablepublic <SOURCE extends SourceI,EX extends java.lang.Throwable> SourceI.SourceIHandler<java.lang.Void> accept(java.lang.Class<SOURCE> sourceType, SourceI.ExceptionalConsumer<SOURCE,EX> action) throws EX extends java.lang.Throwable
EX extends java.lang.Throwable