Although you can't use generics directly, I presume you can define a subclass that inherits from a given generic superclass.
For instance,
class CrudPage<T> {
    // Stuff with T
}

class CustomerCrud extends CrudPage<Customer> {
}

Would this work? I suppose if you used a generic service, then you would have to also instanciate it before using it:
class CrudService<T> { /* stuff */ }
abstract class CrudPage<T> {
    protected abstract CrudService<T> getCrudService();
}

class CustomerCrudService extends CrudService<Customer> { }
class CustomerCrudPage extends CrudPage<Customer> {
    @Inject
    private CustomerCrudService service;
    protected CustomerCrudService getCrudService() { return service; }
}

Jonathan
On 09/03/2009 02:35, Luther Baker wrote:
Yes.

Maybe Tapestry 6 :)

Given that the language keeps changing/moving forward, this seems like an
odd thing to simply leave the user with ... I would guess that Templates,
Components, Pages ... and the way we setup Services in AppModule would
eventually want to consider techniques that wish to leverage Generics.
Obviously, registering something like DataService<Movie>.class is illegal
Java - so it may take a creative approach.

Obviously from a page/component standpoing, there'd have to be a new
convention for such beasts. Naively:

note/EditBlock_Note
idea/EditBlock_Idea

And Services (interfaces and implementations) would be a completely
different problem ... and with things like type erasure and backwards
compatibility ... it all strikes me as an interesting issue.

-Luther



On Sun, Mar 8, 2009 at 6:55 PM, Thiago H. de Paula Figueiredo<
thiag...@gmail.com>  wrote:

Em Sun, 08 Mar 2009 15:46:19 -0300, Luther Baker<lutherba...@gmail.com>
escreveu:

  Is there anyway to use generics as pages, components or edit blocks?
No, because Tapestry uses the class name as URL.

--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to