Re: How To Use A Type Safe Enum As A Custom Value In EOF (was Re: (EOM) entity logic)
Re: How To Use A Type Safe Enum As A Custom Value In EOF (was Re: (EOM) entity logic)
- Subject: Re: How To Use A Type Safe Enum As A Custom Value In EOF (was Re: (EOM) entity logic)
- From: John Bruce <email@hidden>
- Date: Mon, 1 Aug 2005 20:58:01 +1000
Hi Arturo,
What I do is store an Integer as a string in the database and then in
my objectWithArchiveData it converts the string into an Integer and
then returns the correct object. This means that the size of the field
in the databsae has to be at most 3 chars, which is fairly small. I
have a super class which does all of this for each enum.
Not sure if that helps but if you want I can send / post my super
implementation.
Cheers,
John
On 8/1/05, Arturo PĂ©rez <email@hidden> wrote:
> Hi all,
>
> I was looking at this Type Safe Enum pattern. Implemented it, works
> fine but I have a space-efficiency question.
>
> Essentially, what I want is a enum in the C sense where I can specify
> the values; e.g. RED=1, BLUE=2, etc. But using the code below my
> choice of data storage is either a String or NSData. But for space
> efficiency I'ld like to use database smallints.
>
> Is there anyway to get objectWithArchiveData to take anything other
> than strings and NSData? More specifically, is there any way to get it
> to take integer values?
>
> TIA,
> -arturo
>
_______________________________________________
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