commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ola Berg <ola.b...@arkitema.se>
Subject [reflect] Some thoughts
Date Sun, 16 Jun 2002 17:21:24 GMT
In my reflect packet I have the classes Getters, Setters, Adders,
Putters and Constructors and Call and Methods. Setters.set( Object
bean, \"property\", Object value) sets the value on a property etc.
There are also methods for retrieving the type (as a Class) for a
given property, getting all settable properties etc. Mutatis mutandis
for putters, adders and getters.

Inside I have a lookup mechanism based on two Maps: One static
(JVM-singleton) that maps Class to Setters.Info (one Setters.Info
object for each looked up class). Each Setters.Info object has a map
that maps the propertyName to Method object for the corresponding
setMethod(). If the Object bean isn\'t looked up, the Setters class
will look it up. Any possible overhead for reflection is thus reduced
to two lookups in hashtables.

The thing I have found is that Getters, Setters, Putters etc shares
many common mechanisms. Basically, the lookup in each class iterates
through the methods, looking for a method of a certain pattern
(public void setXxx( type)). Which means that one could do a generic
base class for Setters/Getters etc, only providing different
Predicates (that operates on Method objects).

I think I start write some example code tonight and put it on my
webspace. Question is: when one should do such example code, should
one do it as a org.apache.commons.reflect package, or should I provide
a nu.viggo.reflect package? Or does it matter at this stage? (never
been into apache developement before so I don\'t know how you do it).

/O

--------------------
ola.berg@arkitema.se
0733 - 99 99 17

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