commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Victor Volle <>
Subject Re: [clazz] Supported object model list
Date Sun, 27 Oct 2002 12:18:55 GMT

> IClass has the ability to store arbitrary meta data
>  void setMetaData(Object key, Object value)
>  Object getMetaData(Object key)
> but this may be too weak a form of meta data?

What about "pluggable domains", that is for a certain
"domain" like say "EJB" you can configure factories:

   addDomainFactory("ejb", new EJBDomainFactory());

so for the doclet style plugin:

     * ejb:foo=bar

the code would look like:

   // get the meta data extension
   Object extension = clazz.getMetaData("ejb");
   // if no extension is already created ...
   if ( extension == null ) {
      // create a meta data extension by using the configured 
      // DomainFactory
      DomainFactory domainFactory = Global.getDomainFactory("ejb");
       clazz.setMetaData("ejb", domainFactory.createMetaData(clazz));
       extension = clazz.getMetaData("ejb");
   // set the value )probably by reflection again, like here):
   Reflection.setProperty(extension, "foo", "bar");


The DomainFactory would be an interface with
methods to create extensions for MetaClass,
MetaAttribute, MetaOperation, ...

The advantage of this design is that you can have
sophisticated extensions for the MetaElements.
I am using such a design for a code generator.
It has pluggable "adapters" for doclets, reflection
and XML (meta)model files. In XML the "domains"
can be mapped to namespaces.


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

View raw message