Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: java 1.5 enum types and EOs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: java 1.5 enum types and EOs



On Jan 28, 2009, at 16:41, Ricardo J. Parada wrote:

Unfortunately I'm not cool enough for this project as it's not using ERPrototypes (yet). :-)

Well, you don't need ERProrotypes...

public class MyEO{
	...

	public enum Type{
		....
	}

	public Type typeEnum(){
		Integer type = type();
		return type == null ? null :  Type.values()[type];
	}
}

However I did look at the javaEnum prototype in the entities defined in the ERPrototypes framework and it seems like it actually maps it to a string in the database. Again, I'm not using ERPrototypes so I couldn't confirm.

Mapping an enum to a string in the database may take a few more characters but you probably don't need to worry about updating the values in the database if you decide to add a value to your enum values so that their ordinal values are different. But you do have to worry about if you rename an enum value I guess.

Yeah, I that's a pretty good idea, well, depending on your needs... For our project we have a pre-defined set of types that will *never* change, so it was not necessary.


F
_______________________________________________
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


References: 
 >java 1.5 enum types and EOs (From: "Ricardo J. Parada" <email@hidden>)
 >Re: java 1.5 enum types and EOs (From: Stamenkovic Florijan <email@hidden>)
 >Re: java 1.5 enum types and EOs (From: "Ricardo J. Parada" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.