« Return to Thread: Injection of a default property in domain classes

Re: packages and domains

by nycsailor :: Rate this Message:

Reply to Author | View in Thread

Although I can't complain, it was still possible to do.  Maybe we could
add this to some Util class?

On Thu, 2009-06-25 at 19:05 -0400, Scott Burch wrote:

> Good question, but it is because I am looking up the name from the
> controller passed to a filter.  I don't know what the package will be.
> May not even belong to me.  We should have a way to look up a artefact
> by the class name as well.
>
>
>
> On Thu, 2009-06-25 at 17:42 -0500, Ted Naleid wrote:
> > What's the problem with actually putting the package name in the call
> > to getDomainClass/getArtefact?  That's kind of what it's there for, to
> > separate your com.example.foo.Book from your com.example.bar.Book.
> >
> > On Thu, Jun 25, 2009 at 5: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
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: Injection of a default property in domain classes