If you're looking for a one-liner with the same effect, you could always use something like this:
grailsApplication.domainClasses.find { it.name == "Book" }
On Fri, Jun 26, 2009 at 8:19 AM, Scott Burch
<scott@...> wrote:
No, name is correct. The issue was not having a built-in way to find
domain classes by name without the package info. But, that may be
silly. And, as I stated, it was possible just not a one-liner :)
On Fri, 2009-06-26 at 11:34 +0100, Graeme Rocher wrote:
>
domain.name returns to name without the package. You're probably after
> domain.fullName
>
> Cheers
>
> On Thu, Jun 25, 2009 at 11:33 PM, Scott Burch<
scott@...> wrote:
> > I have a problem with grailsApplication.getArtefact .getDomainClass and
> > such.
> >
> > I put my domain classes in packages (like a good programmer :)
> >
> > However, when I do that .getArtefact and such don't see them without the
> > full package name.
> >
> > To get around this, I created a closure that finds artefacts, but it is
> > not very efficient.
> >
> > def findDomainClass = { name ->
> > it = grailsApplication.domainClasses.iterator()
> > while(it.hasNext()) {
> > def n = it.next()
> > if(
n.name == name) {
> > return n
> > }
> > }
> > }
> >
> > Does anyone know a better way. Should we patch grailsApplication to handle this?
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> >
> >
http://xircles.codehaus.org/manage_email
> >
> >
> >
>
>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email