commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitri Plotnikov <dmi...@apache.org>
Subject Re: [clazz] draft reflect implementation
Date Sat, 09 Nov 2002 21:15:04 GMT

----- Original Message -----
From: "Victor Volle" <victor.volle@gmxpro.net>
To: "Jakarta Commons Developers List" <commons-dev@jakarta.apache.org>
Sent: Saturday, November 09, 2002 12:22 PM
Subject: Re: [clazz] draft reflect implementation


> Dmitri,
>
> your work looks very promising!
> I especially like the Idea, that I just have to
> overwrite a method in ReflectScalarPropertyIntrospector
> to match other methods as read/write methods.
>
> There are (currently) two things I do not
> quite understand. As far as I can see,
> all Introspectors scan the complete
> set of available methods. Would it be possible
> to have a list of (pluggable) introspectors like and
> a single loop over all methods. Something like this:
>
>         for (int mc = 0; mc < methods.length; mc++){
>             Method method = methods[mc];
>             for ( int ic = 0; ic < introspectors.length; ic++ ) {
>                  ReflectedPropertyIntrospector inspector = inspectors[mc];
>                  inspector.checkMethod( method, ..., parseResults );
>              }
>         }
I will consider this very seriously.  I think it is a good idea.

>
> Second, I am not sure that the methods
>
>    addClazzLibrary(), getClazz(), constructLibraryArray
>
> and so on, should be part of the Class Clazz.
> They probably belong to a Class Model or something
> like that.
Sure, I could factor them out.

>
> Victor

>
> PS: I am hesitating to offer my help, yet (besides criticism :-))
> because I am still not sure that I can use it for my own project
> and I would like to wait for the "dust to settle".
Critisizm is in fact extremely valuable help.  What I want to know
is what you think needs to be done in clazz for it to be useful for your
project.

Thanks,

- Dmitri

> > I am not really done with the first draft yet, but since I will have to
> > take about a week off from clazz, I wanted to commit what
> > I have done so far and give you a chance to look it over.
> >
> > My initial focus was on implementing functionality equivalent to
> > that of java.beans.Introspector. There are several pretty cool
> > improvements over the Introspector:
> >
> > 1. Highly customizable design.
> >
> >     - You can add new ClazzLibraries for new kinds of Clazzes. So far
> > there is only one such library, ReflectClazzLibrary, but more are
> > coming.
> >
> >     - You can add new ClazzLoaders to customize Clazz generation for
> > individual clazzes or groups of clazzes.
> >
> >     - In the case of Reflected clazzes, you can change the way accessor
> > methods are bound to properties.  For example, if you want to make
> > read methods look like "readFoo()" instead of "getFoo()", it is a matter
> > of overriding one method on ReflectScalarPropertyIntrospector.
> >
> >     - In the case of Reflected clazzes, you can add new categories of
> > properties.  The default list of categories consists of List (which
> > works for Lists as well as arrays), Mapped and Scalar properties.
> >
> > 2. In the case of ReflectedClazzes, richer mapping of accessors to
> > properties: methods like getFoo(int), setBar(key,value), getFooKeySet()
> > etc are recognized.
> >
> > 3. If a property is Mapped, the corresponding clazzProperty.get()
> > returns a Map, even if all the bean defines is a bunch of accessor
> > methods like getFoo(key).  The Map implementation returned by
> > clazzProperty will invoke those accessors if they exist (see the
> > ReflectedMap).
> >
> > 4. Similarly, if a property is a List or an array, the corresponding
> > value is a List (see ReflectedList).
> >
> > 5. Powerful diagnostic facility that optionally prints details of
> > introspection.  You won't have to wonder any more: "how come it does
> > not see my property 'foo'".  I have attached a sample diagnostic log.
> > Check it out, it's pretty cool.
> >
> > The implemented functionality comes with tests, but as you will see not
> > all functionality is implemented yet.
> >
> > Don't look for ATTRIBUTES, DELEGATORS or BEAN stuff yet - I'll get to
> > that in a week or so.
> >
> >
> > - Dmitri
> >
> >
>
>
> --
> To unsubscribe, e-mail:
<mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:commons-dev-help@jakarta.apache.org>
>
>
>


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message