commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Carman" <>
Subject New Component Idea - Commons MetaData
Date Mon, 24 Oct 2005 15:07:09 GMT

JDK5 annotations allow us to supply metadata about classes, methods, fields,
packages, etc.  But, the metadata has to be included in the source code!
Maybe we can come up with a standardized way to register metadata about a
class into some repository.  A discussion at
( gave me the
idea that this could be standardized.  The repository API could look
something like:

public interface MetaDataRepository
  public String getAttribute( Class c, AttributeName name );
  public String getAttribute( Package p, AttributeName name );
  public String getAttribute( Method m, AttributeName name );
  public String getAttribute( Field f, AttributeName name );
  public String getAttribute( Constructor c, AttributeName name );

An AttributeName would basically encapsulate a namespace/name combination,
so that different frameworks can have the same name with different
namespaces.  We would also need to expose an API for modifying the MetaData
for a class, package, etc. so that users can hand-code this.  There could
also be a discovery mechanism for automatically looking up metadata based on
some conventions (similar to how we are talking about it at, so
that users can add metadata to a class without having the source code.  We'd
also provide an adapter for JDK5 annotations (namespace = attribute class
name and name is the attribute name of the annotation type).  We may want to
make the return type Object, also, so that attributes could take on more
complex types (like enums or whatever).  Maybe we could start this project
in the sandbox to see how it shakes out?


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

View raw message