> From: Noel J. Bergman [mailto:[EMAIL PROTECTED] 
> 
> Leo,
> 
> I figure that you should go for it.
> 
> I'd like to hear more about your plans.  JSR 175 is the 
> normative statement of what attributes must be in Java.  How 
> do your plans compare and contrast with JSR 175, nanning, 
> Aspect4J, etc?

The major differences (that I'm aware of) are:

 + I store attributes in generated classes. The classes are
   generated at compile-time by the attribute compiler as
   source files.

 + Attributes are object instances of any class (not just
   serializable). Last I checked, nanning attributes only
   allowed string valued attributes. Attrib4J used .class
   file manipulation, but was moving away from that.

 + I'm sure I'm missing out on something here...

I wish I had a copy of JSR175 - are you aware of any place
I can get it? I've been searching for it in order to make
my implementation sort-of conformant.

An explanation of how my impl works is at:

    http://marc.theaimsgroup.com/?l=avalon-dev&m=105974933614920&w=2:

    (...)

    With the risk that this turns into a "Leo's Picks" column I am also
    beginning to like the way attributes are handled in .Net, with value

    objects. You'd have:

    import org.apache.avalon.framework.attributes.ThreadSafe;
    import org.apache.avalon.framework.attributes.Dependency;

    /**
     *
     * @attribute new ThreadSafe()
     * @attribute new Dependency( MyDependency.class, "my-dep" )
     */
    public class MyComponent {
    }

    This could be compiled into a .java file and then into a .class
file:

    public interface AttributeClass {
        public Set getClassAttributes ();
    }

    import org.apache.avalon.framework.attributes.ThreadSafe;
    import org.apache.avalon.framework.attributes.Dependency;

    public class MyComponent$Attributes implements AttributeClass {
        public static final Set classAttributes = new HashSet ();
        static {
            classAttributes.add ( new ThreadSafe () );
            classAttributes.add ( Dependency( MyDependency.class,
                                  "my-dep" ) );
        }

        public Set getClassAttributes () {
            return classAttributes;
        }
    }

    A standard API would be able to access this via:

    Class c = MyComponent.class;
    Class attributeClass = c.getClassLoader ().loadClass ( c.getName +
        "$Attributes" );
    AttributeClass instance = (AttributeClass)
        attributeClass.newInstance ();
    Set classAttributes = instance.getClassAttributes ();

    and so on...

/LS


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to