[xwiki-devs] [Proposal] QueryManager in store

Vincent Massol vincent at massol.net
Mon May 26 11:36:19 CEST 2008


On May 25, 2008, at 9:12 PM, Vincent Massol wrote:

[snip]

>>> 5) Why do we need to write Language.HQL.name() and not Language.HQL?
>>
>> Because "Language" is Java5 enum, but QueryManager#createQuery  
>> require
>> String (for adding new Languages without modify the Language enum).
>> Ok. This is not good, so I propose to:
>>
>> public interface Query {
>>   static final String HQL = "hql";
>>   static final String XPATH = "xpath";
>>   ...
>> }
>
> btw you don't need static final in an interface ;)
>
> Actually I wouldn't do it like this. Since we're now using  
> components I would create a Query interface and create each  
> implementation as a component. That component will be registered  
> with a <role-hint> of "hql", "xpath", etc.

Actually this is orthogonal. For the component lookup we simply need a  
string which can come from an enum or from a static final String. I'm  
fine with the String.

Still we should implement the Queries as components.

Thanks
-Vincent



More information about the devs mailing list