Bindings as annotation?

From: Anjo Krank (kran..ogicunited.com)
Date: Thu Jul 24 2008 - 03:07:49 EDT

  • Next message: Andrew Lindesay: "Re: Bindings as annotation?"

    Hi,

    Who hasn't been annoyed by the format and configuration of the .api
    files... as we (er, Mike) now control the tools, we might as well
    support a better form of defining wocomponent apis, and one which can
    also show up in java docs. We already have the ..inding foo Foo to
    bind to" javadoc tag, but could do better with annotations with sth
    like:

    @interface WOBindingDefinition {
        String name();

        Whatever defaultValues();
        ... more stuff...
    }

    @interface WOBindingValidation {
        String condition();
        String fail();
    }

    and in a component:

    @WOBindingDefinition { name="isDue", defaultValues=Binding.BOOL_VALUES}
    @WOBindingDefinition { name="dueDate", defaultValues
    =Binding.DATE_VALUES}

    @WOBindingValidation {
        condition = "(dueDate = SET and isDue=UNSET)", fail="If dueDate is
    set then isDue must also be set";
    }
    @WOBindingValidation {
        condition = "(dueDate = SET and isDue=UNSET)", fail="If dueDate is
    set then isDue must also be set";
    }

    You could not only read and eval these in the WOD editor, you could
    provide your own selection lists, you would get actual java doc for
    free and you could also check this on load in the runtime. And it
    would make writing validations WAY easier than it is now (whoever came
    up with these weirdo inverted logic??)...

    What do you think?

    Cheers, Anjo

    --
    iFill, free music from thousands of radio streams
    http://ifill.twosailors.net
    



    This archive was generated by hypermail 2.0.0 : Thu Jul 24 2008 - 03:08:49 EDT