Skip to content

Enrichment

papousek edited this page Jul 30, 2012 · 2 revisions

The Parasim Core provides you the Enrichment object which allows you to enrich instances using Enricher service.

When enrichment.enrich(instance) or enrichment.resolve(method, context) are invoked, all suitable enrichers are called.

Type of your enricher has to be parametrized by type you want to enrich. E.g.

public class ComputationEnricher implements Enricher<Computation> {
    ...
}

Of course you have to register the enricher in your loadable extension:

builder.service(Enricher.class, ComputationEnricher.class);

Default Enrichers

Default enricher are already registered services which are called whenever the enrichment is used.

Providing Enricher

This enricher bind fields annotated by @Provide annotation to the given context.

Injecting Enricher

This enricher tries to inject values resolved by the given context to the fields annotated @Inject annotation to the given context. It also tries to resolve method parameters.