commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Hughes <ahhug...@gmail.com>
Subject Re: [JXPath][BeanUtils] External Bean PropertyDescriptor?
Date Mon, 23 Mar 2009 11:18:30 GMT
Thanks again Matt,
Well in the limited time I have to write code... I've learnt that the
DynamicPropertyHandler does indeed do what I need it to do. I'd also say
that I learnt a few things about it... because the DynamicPropertyHandler is
an inspector of the BeanClass (instance), it's a "slow" mechanism because it
needs to inspect the BeanClass(es) each evalution. Sure it works...
perfect... but slow. I have two solutions both are really the same.. 1) is
to load the BeanClass (refernces) into a DynaBean name/index delegate 2) is
to load the (references) to BeanClass into HashMap<String, List<Object>>.

Whichever is up to the implementation, but it is quite straight foward and
it does lead to some extremely fast lookups 16ms in my case :)

Watch how you store your references and make them optimized and then w00t
for JXPath :)


On Wed, Mar 18, 2009 at 2:41 AM, Matt Benson <gudnabrsam@yahoo.com> wrote:

>
> Possibly you can get some love registering a DynamicPropertyHandler class
> via JXPathIntrospector.registerDynamicClass(...).
>
> -Matt
>
> --- On Mon, 3/16/09, Andrew Hughes <ahhughes@gmail.com> wrote:
>
> > From: Andrew Hughes <ahhughes@gmail.com>
> > Subject: [JXPath][BeanUtils] External Bean PropertyDescriptor?
> > To: "Commons Users List" <user@commons.apache.org>
> > Date: Monday, March 16, 2009, 9:53 PM
> > Hi,
> > I am trying to use JXPath on a not-so-bean complient
> > "Something.java" class.
> > The JXBeanInfo<
> http://commons.apache.org/jxpath/apidocs/org/apache/commons/jxpath/JXPathBeanInfo.html#getDynamicPropertyHandlerClass()
> >
> > method
> > getPropertyDescriptor stipulates that I return a
> > PropertyDescriptor<
> http://java.sun.com/j2se/1.3/docs/api/java/beans/PropertyDescriptor.html>
> > in
> > order to allow JXPath to get/set the properties within
> > "Something.java". The
> > problem is that the not-so-bean-complient "Something.java"
> > class doesn't
> > have get/set equivalent methods. It actually has iterator()
> > and from that
> > you can then iterate over all "properties" and work with
> > them directly.
> >
> > Can I somehow inject a method implementation or proxy
> > object outside of
> > "Something.java" that will provide the required logic/code
> > to perform the
> > get/set operation on Something.java's properties?
> >
> > Any help would be much appreciated :)
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message