-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Could @Type take a Class rather than String?
PostPosted: Wed Apr 06, 2005 4:14 pm 
Beginner
Beginner

Joined: Sat Jan 17, 2004 5:35 am
Posts: 25
Location: Birmingham, UK
Hi there,

I've been using @Type & wondering if there's a reason why it takes a classname String rather than a Class object? A Class object would participate in code refactoring easier than classname Strings, and also reduces the verbosity:

Code:
@Type(type = MyUserType.class)


Instead of:

Code:
@Type(type = "com.acme.data.usertypes.MyUserType")


We could also reduce it further by renaming the type() annotation method to the default annotation value() method:

Code:
@Type(MyUserType.class)


Although I see @Type's destined for further methods, so maybe this step isn't appropriate.

The only reason I can see for choosing classnames over classes is that the UserType's don't have to be in the project's classpath, but surely this is typically due to bad project structure?

Mark


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 07, 2005 10:41 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Actually type may refer a typedef name and not a class.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 07, 2005 5:52 pm 
Beginner
Beginner

Joined: Sat Jan 17, 2004 5:35 am
Posts: 25
Location: Birmingham, UK
This is true.. ;) Couldn't both be supported?:

Code:
@Type(typedef="text")
@Type(type=MyUserType.class)


Just feel it'd be a shame to miss out on rich parameter types by mirroring mapping XML.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 07, 2005 7:26 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I've not decided yet. I try to follow the EJB3 spec stype for now

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 08, 2005 4:50 am 
Beginner
Beginner

Joined: Sat Jan 17, 2004 5:35 am
Posts: 25
Location: Birmingham, UK
Sure, just thought it worth discussing whilst in alpha-stage. Keep up the great work with annotations, it's a joy to use.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.