public abstract class Enricher<M extends com.google.protobuf.Message,C extends io.spine.core.EnrichableMessageContext> extends java.lang.Object implements EnrichmentService<M,C>
Modifier | Constructor and Description |
---|---|
protected |
Enricher(EnricherBuilder<M,C,?> builder)
Creates a new instance taking functions from the passed builder.
|
Modifier and Type | Method and Description |
---|---|
java.util.Optional<io.spine.core.Enrichment> |
createEnrichment(M message,
C context)
Creates an enrichment for the passed message.
|
<E extends EnrichableMessageEnvelope<?,?,M,C,E>> |
enrich(E source)
Enriches the passed message if it can be enriched.
|
protected Enricher(EnricherBuilder<M,C,?> builder)
public <E extends EnrichableMessageEnvelope<?,?,M,C,E>> E enrich(E source)
do_not_enrich
is not set in the
Enrichment
instance of the context of the outer object of
the message.source
- the envelope with the source messagejava.lang.IllegalArgumentException
- if the passed message cannot be enrichedpublic java.util.Optional<io.spine.core.Enrichment> createEnrichment(M message, C context)
EnrichmentService
createEnrichment
in interface EnrichmentService<M extends com.google.protobuf.Message,C extends io.spine.core.EnrichableMessageContext>
message
- the enrichable messagecontext
- the context of the enrichable messageOptional
if the passed message cannot be enriched