• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Inner Java Enum as value class in EntityModeler [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inner Java Enum as value class in EntityModeler [SOLVED]


  • Subject: Re: Inner Java Enum as value class in EntityModeler [SOLVED]
  • From: Riccardo De Menna <email@hidden>
  • Date: Sat, 7 Nov 2009 07:49:12 -0800

Hi Johann,

Thank you for your advice. As you suggested, solving the issue was just a matter of tweaking the templates. I'm using some custom written ones but for anyone with the same issue it's just a matter of sprinkling a bunch of '.replace('$','.')' after any occurrence of the misspelled class name.

As an example taken from the usual _WonderEntity.java, replacing line

public static final ERXKey<$attribute.javaClassName> $ {attribute.uppercaseUnderscoreName} = new ERXKey< $attribute.javaClassName>(${attribute.uppercaseUnderscoreName}_KEY);


with line:

public static final ERXKey<$attribute.javaClassName.replace('$','.') > ${attribute.uppercaseUnderscoreName} = new ERXKey< $attribute.javaClassName.replace('$','.')>($ {attribute.uppercaseUnderscoreName}_KEY);


Fixes the issue... hope this can help others as well,

Cheers,
rdm

On 07/nov/2009, at 02.46, Johann Werner wrote:

Hi Riccardo,

some time ago I had the very same problem using inner enums in Entity Modeler. I found that the easiest way was to move those enums out of their outer class and make them "normal" enums. The other, more laborious, way would be to tweak the eogenerator templates to do the replacement of '$' by '.' automatically.

jw


Am 07.11.2009 um 10:03 schrieb Riccardo De Menna:

Hi,

This issue was already discussed once but I can't really find if it was fixed somehow and I'm missing the obvious.

I'm trying more and more to force myself to use Java Enums whenever possible (instead of static fields) and often I find myself in need to serialize them to db for storage.

So I write nice to/from PLIST/BLOB factory and conversion methods to dump my Enums into whatever storage I'm using. This unfortunately requires me to fill in Entity Modeler's 'Value Class' field using an inner class (actually it's an inner Enum).

I can't use the Class.InnerClass notation. It only works with the Class$InnerClass notation. The problem is that the template then will also pickup the $ thing and wrongly write bugged templates that I have to manually fix.

It's only a matter of searching all the '$' and replacing them with a '.', but it can be tedious when you are tweaking the model often.

Is there a way to use an inner class without having to manually patch the generated templates?

rdm




_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Inner Java Enum as value class in EntityModeler [SOLVED]
      • From: "Ricardo J. Parada" <email@hidden>
References: 
 >Inner Java Enum as value class in EntityModeler (From: Riccardo De Menna <email@hidden>)
 >Re: Inner Java Enum as value class in EntityModeler (From: Johann Werner <email@hidden>)

  • Prev by Date: Re: Uses for D2JC (was: Gianduia and WO)
  • Next by Date: Re: Inner Java Enum as value class in EntityModeler [SOLVED]
  • Previous by thread: Re: Inner Java Enum as value class in EntityModeler
  • Next by thread: Re: Inner Java Enum as value class in EntityModeler [SOLVED]
  • Index(es):
    • Date
    • Thread