stick them in the base package, extend the class and it works great 

----- Original Message -----

From: "Barry Books" <trs...@gmail.com> 
To: "Tapestry users" <users@tapestry.apache.org> 
Sent: Monday, 20 May, 2013 2:31:18 PM 
Subject: Re: trying to avoid code bloat 

I would not use an Abstract page for this purpose. The first problem is 
protected will not work because the pages will not have the same package. I 
would create a service with these services and just inject that. So your 
page would just have 

@Inject 
private Services services; 

and your service will have a constructer and get methods: 

class Services(Service1 service1, ...) { 
this.service1 = service1; 
} 

public Service1 getService1() { 
return service1; 
} 




On Sun, May 19, 2013 at 9:59 PM, Ken in Nashua <kcola...@live.com> wrote: 

> Hi Folks, 
> 
> Can i construct an abstract page and inject a bunch of services and then 
> have derived instances extend from that ? 
> 
> I tried it and seeing some weird class format errors. 
> 
> I did it with my model entities. 
> 
> trying to do it with pages and injectables. 
> 
> public abstract class AbstractPage implements 
> org.tynamo.examples.pphl.pages.interfaces.IAbstractPage, ExceptionReporter { 
> 
> /** 
> * services and injectables 
> */ 
> @Inject 
> protected Logger logger; 
> 
> @Inject 
> protected DescriptorService descriptorService; 
> 
> @Inject 
> protected HibernatePersistenceService hibernatePersistenceService; 
> 
> @Inject 
> protected Messages messages; 
> 
> @Inject 
> protected PropertyAccess adapter; 
> 
> @Inject 
> protected ValueEncoderSource valueEncoderSource; 
> 
> @Inject 
> protected ComponentDefaultProvider cdp; 
> 
> @Inject 
> protected ComponentResources resources; 
> 
> @Inject 
> protected ApplicationStateManager applicationStateManager; 
> 
> @Inject 
> protected PersistenceService persistenceService; 
> 
> @Inject 
> protected SecurityService securityService; 
> 
> 

Reply via email to