sry english. have next problem. have 3 entities: domainmanager, domain , node. domainmanager singleton able create list of domain objects. each domain can create list of node objects:
domainmanager 1<>-----* domain 1<>----* node
i want:
- node implementation can inject corresponding parent domain himself.
- node implementation can inject domain manager instance too.
class nodeimpl { @inject nodeimpl(domain parentdomain, domainmanager domainmanager) {
} }
how can this?
it's difficult answer without knowing want do nodes , domains but, following jfpoilpret's (+1) advice using @assisted injected parameters might you. see this answer or (even better) this details of how works.
having said that, constructor nodeimpl might this:
@inject public nodeimpl(domainmanager manager, @assisted domain) {}
you create nodefactory hand instances of nodeimpl. however, still need uses nodefactory figure out nodes associated domains.
Comments
Post a Comment