[ 
http://team.ops4j.org/browse/QI-329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18082#comment-18082
 ] 

Paul Merlin commented on QI-329:
--------------------------------

To come back on this issue, I don't think we have a bad design bud it's now 
sure something has been overlooked and my analysis shown above was incomplete. 
Besides, lookup methods are all plural but only some (Entities and Services) do 
return iterables.

Composite Types Lookups occur in three usecases:

- creating new composites instances (All of them except Services)
- getting composites instances from stored state (Entities only)
- injection/lookup of services (Services only)

We need strict type lookup resulting to a single type for the first one.

We need lax type lookup resulting to several types for the second and the third 
ones.
It is needed for Entities to allow polymorphic fetch and queries.
It is needed for Services as we allow Iterable<?> injection/lookup and want 
polymorphic injections.

Here is my proposal:

- distinguish creational from non-creational type lookups
- creational lookups are strict and result to a single type
- non-creational lookups are lax and result to several types
- for objects, transients and values, only the creational lookup is needed
- for entities, both creational and non-creational lookups are needed
- for services, only the non-creational lookup is needed

If you see no show-stopper in this proposal I'll go on with this issue in a 
branch so we can
cosily review the code before merging.

Moreover, Service type lookup has generics support. I wonder if it could be 
applicable to other composite types.

Tell me what you think.

/Paul
                
> ValueBuilderFactory doesn't perform correct type-to-composite lookup
> --------------------------------------------------------------------
>
>                 Key: QI-329
>                 URL: http://team.ops4j.org/browse/QI-329
>             Project: Qi4j
>          Issue Type: Bug
>          Components: Core Runtime
>            Reporter: Niclas Hedhman
>             Fix For: 2.0 - Reductionism
>
>         Attachments: entities-ambiguous-check-tests-reports.tar.gz
>
>
> When doing 
> {code}
> ValueBuilder<DomainEvent> builder = vbf.newValueBuilder(DomainEvent.class)
> {code}
> Type-to-Composite lookup/search is not happening.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
http://team.ops4j.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to