Hi Faizel,
I had created a Jira about this and I put your code as the proposed
solution.
See http://issues.objectstyle.org/jira/browse/WONDER-263
:-)
On May 9, 2009, at 3:34 AM, Faizel Dakri wrote:
>
> 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 : Sat May 09 2009 - 12:35:05 EDT