[xsd-users] Custom get/set methods

Jeroen N. Witmond [Bahco] jnw at xs4all.nl
Thu Nov 15 15:04:57 EST 2007


Hi Boris,

This is merely a thougth, but why not store all needed transformations in
a configuration file in XML? So xsd at least should not have any trouble
parsing it. :)

More specifically, a configuration file could contain one regex for
setters, one for getters, and one for whatever you like.

For instance:

<transformations>

    <transform function="getter" regex="/$([^ ])+/get\1/"/>

</transformations>

On second thought, you may even want to store equivalent of any command
line option in a configuration file.

Just my two cents ...

> Hi Vinay,
>
> Mogulothu, Vinay K <vinay.mogulothu at lehman.com> writes:
>
>>   Thank you. We have looked at the option of customizing the generated
>> types, but as you mentioned it requires scripts to add the custom
>> wrappers for this option. We are interested in generating custom
>> class/function names. Please let us know if this feature is an easy
>> addition.
>
> It shouldn't be too difficult to add. The only concerns we have at the
> moment are: (1) whether the regex approach will be able to handle all
> desired transformations and (2) how to pass this information to the
> compiler.
>
> For (1), we need to make sure that we can support common naming
> conventions, e.g., "lower case and underscore", "camel case",
> "smalltalk", etc. Your case should be fairly easy to handle
> since all you need to do is to add the 'get' or 'set' prefix
> and capitalize the first letter of the original name.
>
> For (2) we normally use command line options but depending on
> how many expressions one may want to provide (right now it is
> at least three: getter function, setter function, and class),
> this could get messy. So will need to think about alternative
> methods.
>
> If anybody has any ideas or suggestions (Ray?), they will be
> much appreciated.
>
> I will give it some more thoughts and will try to implement this
> idea next week. I should have a pre-release for you to try by
> the end of next week.
>
> Boris
>
>





More information about the xsd-users mailing list