Re: Bindings as annotation?

From: Q (qdola..mail.com)
Date: Thu Jul 24 2008 - 06:01:03 EDT

  • Next message: Anjo Krank: "Re: Bindings as annotation?"

    On 24/07/2008, at 5:07 PM, Anjo Krank wrote:

    > 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:
    >
    >..nterface WOBindingDefinition {
    > String name();
    >
    > Whatever defaultValues();
    > ... more stuff...
    > }
    >
    >..nterface WOBindingValidation {
    > String condition();
    > String fail();
    > }
    >
    > and in a component:
    >
    >..OBindingDefinition { name="isDue",
    > defaultValues=Binding.BOOL_VALUES}
    >..OBindingDefinition { name="dueDate", defaultValues
    > =Binding.DATE_VALUES}
    >
    >..OBindingValidation {
    > condition = "(dueDate = SET and isDue=UNSET)", fail="If dueDate is
    > set then isDue must also be set";
    > }
    >..OBindingValidation {
    > 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??)...

    Yes, it does my head in too.

    > What do you think?

    Looks interesting, but how would you write something like this one?

    <validation message="Either items, nameKey and valueKey or dataset
    must be bound">
        <or>
            <and>
                  <or>
                      <unbound name="items"/>
                      <unbound name="nameKey"/>
                      <unbound name="valueKey"/>
                  </or>
                  <unbound name="dataset"/>
            </and>
            <and>
                <or>
                    <bound name="items"/>
                    <bound name="nameKey"/>
                    <bound name="valueKey"/>
                </or>
                <bound name="dataset"/>
            </and>
        </or>
    </validation>

    -- 
    Seeya...Q
    

    Quinton Dolan - qdola..mail.com Gold Coast, QLD, Australia (GMT+10) Ph: +61 419 729 806



    This archive was generated by hypermail 2.0.0 : Thu Jul 24 2008 - 06:02:17 EDT