commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [lang] Reflection utils [was: 1.0 release foci]
Date Wed, 14 Aug 2002 09:07:07 GMT
Before we start on reflection in lang, we need to agree some basic things. Here's my list.

1) No code that implies beans.
That is in [beanutils]

2) Only static utilty classes.
This fits with [lang] and creates less issues.
This excludes Ola's code below, but that should be destined for [introspect] (a new project
to replace Sun's bean Introspector)

3) One class or many?
ClassUtils, FieldUtils, ConstructorUtils & MethodUtils

4) Exception handling?
Do we throw the Sun exceptions directly, or do we wrap all the Sun exceptions in a single
ReflectionException (using NestedException).

These strike me as the basics that need agreement before we start. The code itself should
draw on code previously written by [beanutils], [jxpath], and others.


>  from:    Ola Berg <>
> Hen writes:
> >I\'ve pushed the ClassUtils class back into the Lang cvs tree for
> >consideration. Methods are:
> >    public static java.lang.Object createObject(java.lang.String);
> >    public static java.lang.Object createObject(java.lang.Class);
> >    public static boolean classExists(java.lang.String);
> >    public static java.lang.Class getClass(java.lang.String);
> >    public static boolean classInstanceOf(java.lang.Class, java.lang.String);
> >    public static boolean classImplements(java.lang.Class, java.lang.String);
> >    public static boolean classExtends(java.lang.Class, java.lang.String);	
> In a bunch of code I gave Stephen, the questions answered in the boolean methods of your
interface are implemented as separate Predicate\'s. General util classes for Class, Method,
Field, Member etc can take such Predicates and filter out the relevant. So one can create
a Predicate that evaluate()s to true for \"class whose name begins with Foo that is somewhere
in the org.apache structure that implements Bazilizable and has a protected static method
with three parameters\" or anything.
> This semi-architecture was intended to go in some kind of [reflect] package. If [lang]
should do ClassUtils and FileUtils kind of stuff, as in your interface, i suggest that the
predicate based architecture goes into lang. 
> (Or thinking about it, in the block I sent to Stephen, the Class predicates was not implemented.
But they should work in this way)
> /O
> --------------------
> 0733 - 99 99 17
> --
> To unsubscribe, e-mail:   <>
> For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message