All,

I think I have moaned about it a number of times, but I don't like
having to
write lots of:

    public void configure (Configuration config) 
        throws ConfigurationException {
        myField = configuration.getAttribute ("my-field");
        myOtherField = configuration.getAttributeAsInteger
("my-other-field");
        ...
    }

or:

    public MyClass (String _myField, int _myOtherField, ... ) {
        this.myField = _myField;
        this.myOtherField = _myOtherField;
        ...
    }

So I did some experimenting with commons-attributes, and ended up with
something like this:

    /**
     * @@ConfigurableField ("@my-field")
     */
    private String myField;

    /**
     * @@ConfigurableField ("@my-other-field")
     */
    private int myOtherField;

The container would then, before calling configure(), set all
ConfigurableFields
in the class. Then configure() would be called, allowing the component
to
do whatever special configuration processing required.

(Since this required changes to the container, I moved the functionality
into
an "AbstractConfigurable" class that would do the setting in the
configure() method.)

Anyway, just thought you'd like to know.

/LS


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

Reply via email to