Re: EOGen-Templates an javaEnum

From: Johann Werner (j..yosys.de)
Date: Wed May 13 2009 - 06:25:50 EDT

  • Next message: kenlist..nderhome.com: "Ajax fails on deployment machine"

    Hi Fez,

    thanks for your reply. I didn't further try to find an solution for
    this. Being short of time I just changed my inner enumerations to
    outer ones. With those there is no package name problem.

    jw

    Am 09.05.2009 um 09:34 schrieb Faizel Dakri:

    >
    > On Apr 6, 2009, at 05:04 AM, Johann Werner wrote:
    >
    >> I just tried to use the new javaEnum prototypes. I have an entity A
    >> that has an inner enum E. In Entity Modeler I am setting the class
    >> of my attribute to my.package.name.A$E. Unfortunately EOGenerator
    >> then produces class files that have the '$' in the type name which
    >> Eclipse doesn't like. For example I am getting with the stock
    >> Wonder templates:
    >>
    >> public final ERXKey<my.package.name.A$E> STATUS = new
    >> ERXKey<my.package.name.A$E>("status");
    >>
    >> with an error 'my.package.name.A$E cannot be resolved to a type'.
    >>
    >> If I replace the '$' with a '.' everything is ok. I tried to figure
    >> out how to tell EOGenerator to replace that string but I had no
    >> success so far. Before digging deeper into Velocity&Co I wanted to
    >> ask if someone did resolve this problem already or could point me
    >> into the right direction to achieve this in the EOGen templates.
    >
    > The way I've gotten around this is to modify my velocity templates
    > so that they perform a string substitution on the attribute's
    > javaClassName. For example, in your template you probably have
    > something like this for your attributes (I've modified my templates,
    > so yours might not look exactly the same as mine below):
    >
    > public static final ERXKey<$attribute.javaClassName> $
    > {attribute.uppercaseUnderscoreName} =
    > new ERXKey<$attribute.javaClassName>("$attribute.name");
    >
    > You want to augment the part that inserts the
    > $attribute.javaClassName so that it replaces the '$' with a '.'
    > character (i.e. you want the source form of the enum's name, not the
    > binary form):
    >
    > public static final ERXKey<
    > $attribute.javaClassName.replace("$",".")> $
    > {attribute.uppercaseUnderscoreName} =
    > new ERXKey<
    > $attribute.javaClassName.replace("$",".")>("$attribute.name");
    >
    > This may not be the most robust solution to the problem, but it has
    > worked for me so far.
    >
    > Fez
    >
    > --
    > Faizel Dakri
    > faize..akri.com
    >
    >
    >
    >





    This archive was generated by hypermail 2.0.0 : Wed May 13 2009 - 06:26:52 EDT