[hibernate-dev] Interface for mapping classes : Programmatic API

Emmanuel Bernard emmanuel at hibernate.org
Tue Dec 15 04:07:50 EST 2009


Well yes, ideally I would like to get SearchMapping as an interface but the big question becomes: how do I get the SearchMapping instance from? and how easy is that.


On 14 déc. 2009, at 18:58, Amin Mohammed-Coleman wrote:

> Hi Sanne
> 
> Thanks for your reply. I was thinking mostly around implementation  
> side of things. I guess it would be great to get an idea or discuss  
> how this may impact the API. I know Emmanuel mentioned moving  
> SearchMapping into an interface.
> 
> Cheers
> 
> Amin
> 
> Sent from my iPhone
> 
> On 14 Dec 2009, at 14:56, Sanne Grinovero <sanne.grinovero at gmail.com>  
> wrote:
> 
>> Hi Amin,
>> your idea looks good to me; is this discussion affecting only
>> implementation or does it have some impact on APIs?
>> This is just to check for yourself that you're not forgetting  
>> something right?
>> Just wondering: it makes sense in both cases, sorry I'm looking into
>> it after much time.
>> 
>> Cheers,
>> Sanne
>> 
>> 2009/12/14 Amin Mohammed-Coleman <aminmc at gmail.com>:
>>> Hi
>>> 
>>> It seems as though my email may have been a bit too vague. So I'll  
>>> try to
>>> explain more or provide some more information to get some advice.
>>> 
>>> At present none of the mapping class extend any particular  
>>> interface or
>>> extend any abstract classes so it becomes difficult to a certain  
>>> extent to
>>> remember what methods need to be present at the entity/property level
>>> mapping.
>>> 
>>> I know I have forgotten to add factory methods on some of the mapping
>>> classes when they were required.  I was therefore thinking would it  
>>> be
>>> worthwhile introducing some form of interface that enforces the  
>>> correct
>>> factory methods are implemented if you are creating a property  
>>> level mapping
>>> or an entity level mapping.  So basically something in the lines of
>>> 
>>> public interface PropertyLevelMapping  {
>>> 
>>> public FieldMapping field();
>>> 
>>> public CalendarBridgeMapping calendarBridge(Resolution resolution);
>>> 
>>> ....
>>> }
>>> 
>>> 
>>> public interface EntityLevelMapping {
>>> 
>>> public FullTextFilterDefMapping fullTextFilterDef (Class<?> impl);
>>> 
>>> .....
>>> }
>>> 
>>> So if a mapping class applies to both entity and property level  
>>> then the
>>> mapping class would implement both.
>>> 
>>> Again I'm not sure if this the correct approach or there is  
>>> something better
>>> that can be used.
>>> 
>>> Hope this provides some more info and apologies for not making it  
>>> more
>>> clear!
>>> 
>>> Cheers
>>> Amin
>>> 
>>> On Thu, Dec 10, 2009 at 8:12 PM, Amin Mohammed-Coleman <aminmc at gmail.com 
>>>> wrote:
>>> 
>>>> Hi
>>>> 
>>>> I was wondering whether to get some thoughts about the following:
>>>> 
>>>> At present none of the mapping classes implement any interface or  
>>>> extend
>>>> any abstract classes.  So I was thinking of introducing some form of
>>>> interface for property level mapping so that one remembers (mostly  
>>>> me :)) to
>>>> add all the methods required at the property level and the same  
>>>> for the
>>>> entity level.  I'm not sure about this so it would be cool if I  
>>>> could get
>>>> your thoughts or start some form of discussion around it.
>>>> 
>>>> 
>>>> Cheers
>>>> 
>>>> Amin
>>>> 
>>> _______________________________________________
>>> hibernate-dev mailing list
>>> hibernate-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>> 
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev





More information about the hibernate-dev mailing list