I'm referring to the java.lang.reflect.InvocationHandler. You can use it create proxy 
objects for interfaces "on-the-fly". I've used it extensively as a way of adapting 
mismatched interfaces between objects.

--Kevin

-----Original Message-----
From: David Graham [mailto:dgraham1980@;hotmail.com]
Sent: Wednesday, October 30, 2002 4:35 PM
To: [EMAIL PROTECTED]
Subject: RE: [OT] Getting a Collection's size in JSTL


What is a DynamicProxy?  We may be talking about the same pattern with 
different names.

David






>From: "Kevin A. Smith" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>Subject: RE: [OT] Getting a Collection's size in JSTL
>Date: Wed, 30 Oct 2002 16:31:03 -0500
>
>This also seems like a good place to use a DynamicProxy. Since most all of 
>the Java Collections package is interfaced base, this seems like it might 
>be an elegant solution.
>
>--Kevin
>
>-----Original Message-----
>From: David Graham [mailto:dgraham1980@;hotmail.com]
>Sent: Wednesday, October 30, 2002 3:44 PM
>To: [EMAIL PROTECTED]
>Subject: Re: [OT] Getting a Collection's size in JSTL
>
>
>That's pretty much what I did except you can only set the internal
>collection in the constructor.  It's an elegant solution that should
>probably (in some form) be included in a larger library.
>
>David
>
>
>
>
>
>
> >From: Kris Schneider <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >To: Struts Users Mailing List <[EMAIL PROTECTED]>
> >Subject: Re: [OT] Getting a Collection's size in JSTL
> >Date: Wed, 30 Oct 2002 15:30:13 -0500
> >
> >It should also be relatively painless to use a composition/delegation
> >approach.
> >
> >public class CollectionBean {
> >
> >   private Collection c;
> >
> >   public int getSize() {
> >     return this.c.size();
> >   }
> >
> >   public void setCollection(Collection c) {
> >     this.c = c;
> >   }
> >
> >   public Collection getCollection() {
> >     return this.c;
> >   }
> >}
> >
> ><jsp:useBean id="collBean" class="com.foo.CollectionBean"/>
> ><c:set target="${collBean}"
> >        property="collection"
> >        value="${requestScope.theCollection}"/>
> ><c:out value="${collBean.size}"/>
> >
> >Or something along those lines. Of course, you could completely set up 
>the
> >collection bean prior to hitting the JSP as well.
> >
> >Quoting David Graham <[EMAIL PROTECTED]>:
> >
> > > I actually thought of a better idea which is getting into commons
> > > collections territory but I'll post a quick description here.  I made 
>a
> > > JstlCollectionWrapper class that wraps any Collection object and
> >implements
> > >
> > > the Collection interface.  I added a getSize() method to this class.
> >The
> > > business layer classes can return standard Java collections like
> >ArrayList
> > > and you can wrap them in this class when using them in JSTL.
> > >
> > > A similar approach could be taken with the Map interface.  I wish they
> >would
> > >
> > > just add getSize to the standard classes :-(.
> > >
> > > David
> >
> >--
> >Kris Schneider <mailto:kris@;dotech.com>
> >D.O.Tech       <http://www.dotech.com/>
> >
> >--
> >To unsubscribe, e-mail:
> ><mailto:struts-user-unsubscribe@;jakarta.apache.org>
> >For additional commands, e-mail:
> ><mailto:struts-user-help@;jakarta.apache.org>
>
>
>_________________________________________________________________
>Protect your PC - get McAfee.com VirusScan Online
>http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>
>
>--
>To unsubscribe, e-mail:   
><mailto:struts-user-unsubscribe@;jakarta.apache.org>
>For additional commands, e-mail: 
><mailto:struts-user-help@;jakarta.apache.org>
>
>
>--
>To unsubscribe, e-mail:   
><mailto:struts-user-unsubscribe@;jakarta.apache.org>
>For additional commands, e-mail: 
><mailto:struts-user-help@;jakarta.apache.org>


_________________________________________________________________
Unlimited Internet access for only $21.95/month.  Try MSN! 
http://resourcecenter.msn.com/access/plans/2monthsfree.asp


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>

Reply via email to