Proposal for clazz Package
(0) Rationale
The Java Reflection Framework provides a set of classes for accessing
and calling classes, methods and fields dynamically at runtime. In
addition, the beans Introspector class provides for examination of
java beans. Together these offer very useful functionality that is
widely used by todays applications.
There is a need for reflection and introspection code in a great many of
the Commons, Jakarta and Apache projects. However, the standard Java
classes have proved inadequate, causing each project to write their own
reflection helper classes. In addition, many projects also require metadata
to be stored against classes and properties. This is not supported by the
current Java APIs.
The Clazz package will focus on introspection and class
manipulation.
Reflection helper code is located in the [lang] package.
(1) Scope of the Package
The Clazz package shall create and maintain a package that provides
introspection and class manipulation handling built upon the Java Reflection
Framework and other providers, such as byte and source code
readers/generators.
The package should:
- handle all classes, not just beans
- support extensible metadata (not just for GUI builders)
- handle normal (today) bean conventions (get/set/add/put methods)
- handle future conventions that are not yet standard
- support method overloading
- provide a complete alternative to using java.beans.Introspector
- be simple to learn
In terms of code, [clazz] would begin by having classes/interfaces that
represent a class, method and field like reflection. It would then provide
mechanisms to build the structure via reflection and BCEL, and ideally to
generate classes from the structure using BCEL. Note: One possibility would
be to say that the BCEL dependency belongs in BCEL, and the commons version
just uses reflection.
[clazz] would also provide mechanisms for identifying methods as being
property methods, coping with modern conventions such as addXxx(), lists and
maps that the beans introspector doesn't. This would allow [clazz] to be
used by betwixt and digester to add flexibility. (I remember reading a case
where some swedish company had insisted on localising the words get and set
in bean methods - [clazz] could cope with that)
(1.5) Interaction With Other Packages
clazz relies only on standard JDK 1.2 (or later) APIs for
production deployment. It utilizes the JUnit unit testing framework for
developing and executing unit tests, but this is of interest only to
developers of the component.
No external configuration files are utilized.
(2) Initial Source of the Package
These types of classes are splashed around various Apache
subprojects. We intend to seek them out and integrate them.
The proposed package name for the new component is
org.apache.commons.clazz
.
(3) Required Jakarta-Commons Resources
- SVN repository - New directory
clazz
in the
jakarta-commons
SVN repository.
- Mailing List - Discussions will take place on the general
dev@commons.apache.org mailing list. To help
list subscribers identify messages of interest, it is suggested that
the message subject of messages about this component be prefixed with
[clazz].
- Bugzilla - New component "clazz" under the "Commons" product
category, with appropriate version identifiers as needed.
- Jyve FAQ - New category "commons-clazz" (when available).
(4) Initial Committers
The initial committers on the Clazz component shall be: