commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitri Plotnikov <dplot...@yahoo.com>
Subject Re: [clazz] draft reflect implementation
Date Mon, 18 Nov 2002 17:22:10 GMT
Stephen,

--- Stephen Colebourne <scolebourne@btopenworld.com> wrote:
> I've finally had a chance to take a look at this. Its great work ;-)
Thank you.

> Some questions:
> - will it handle the case of defining
>  int getAge()
>  void setAge(String age)
>  void setAge(int age)
Currently it will reject this property altogether as having to
accessors. What should it do?  And generally speaking, how do we
justify our choices in how methods are mapped to properties?  Do you
think we have the authority to introduce some kind of a "standard"?
Taking into account the customizability of clazz, I believe we might. 
Thus, why not simply decide what we are going to do by default in all
these cases by voting?  For example, in the above case we probably have
three reasonable solutions:

1. Reject the methods as conflicting
2. Accept the setAge(int) method as the getter and ignore
setAge(String)
3. Accept them both and decide dynamically which one to call based on
the type (and perhaps converability) of the value.


> - Can we handle related accessors, eg.
>  int getAge()
>  int getAgeAsString()
>  void setAge(int age)
>  void setAgeAsString(String age)
I like this very much. "set<property capitalized>As<anything
capitalized>".

> - Should ClazzProperty objects expose their read/write methods etc
> via
> ClazzOperation/Operation objects?
I say +1

> - How do you actually do the plugin? I can see where to override, but
> I
> can't see where to make the override happen.
How stupid of me. The createReflectClazz(library, javaClass) is missing
on ReflectClazzLoader.  I'll add it.

> One thing we do have to be careful of is not to make it too
> complicated. I'm
> never sure exactly where that boundary is, and documentation always
> helps. 
I think we'll need a tutorial specifically on customization of clazz,
because customization is *the* primary attraction here. I'll write a
draft.

> I also like lots of small packages, would reflect.list, reflect.map
and
> reflect.scalar help?
Sure, why not - I'll do that.

> Stephen
- Dmitri

> 
> ----- Original Message -----
> From: "Dmitri Plotnikov" <dmitri@apache.org>
> > 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>
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

--
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