IntelliJ open source
[Logo] JavaRanch » JavaRanch Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Win a copy of JBoss AS 5 Development this week in the JBoss forum
or Spring Dynamic Modules in Action in the Spring forum!
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » Java in General
 
RSS feed
 
New topic
Author

is enum type serializable by default?

Balaji Natarajan
Greenhorn

Joined: Nov 24, 2007
Messages: 29

Hi all,
I am creating an enum type (public enum ApplicationEnum) and using it as a class member in a domain object. Is this ApplicationEnum (which is of type enum) is serializable by default or do i have to explicitly declare the enum ApplicationEnum as Serializable.

Lastly, is enum involved in a Serialization mess?

Thanks aton for all your help.

Regards,
Balaji N

Best Regards,<br />Balaji Natarajan<br /> <br />SCJP 1.5 100%<br />SCWCD 1.5 92%<br />SCBCD (In Progress)
Jelle Klap
Ranch Hand

Joined: Mar 10, 2008
Messages: 411

Sun's enum tutorial:
All enums implicitly extend java.lang.Enum.


java.lang.Enum Javadoc:
All Implemented Interfaces: Serializable, Comparable<E>



[ August 22, 2008: Message edited by: Jelle Klap ]

There's no place like 127.0.0.1
Joanne Neal
Rancher

Joined: Aug 05, 2005
Messages: 1699

Originally posted by Balaji Natarajan:
I am creating an enum type (public enum ApplicationEnum) and using it as a class member in a domain object. Is this ApplicationEnum (which is of type enum) is serializable by default or do i have to explicitly declare the enum ApplicationEnum as Serializable.


Write a piece of code that creates an instance of your enum and then uses instanceof to check if it implements the Serializable interface.

Edit - or you could look at the documentation

Originally posted by Balaji Natarajan:
Lastly, is enum involved in a Serialization mess?


What do you mean by 'a Serialization mess' ?
[ August 22, 2008: Message edited by: Joanne Neal ]

Joanne
Balaji Natarajan
Greenhorn

Joined: Nov 24, 2007
Messages: 29

Thanks for your replies.

i meant would enums be involved in Serialization?
Sorry for the language used.

Now i understood that it will be taking part in serialization since it is serializabe.

Thanks for your help.

Best Regards,<br />Balaji Natarajan<br /> <br />SCJP 1.5 100%<br />SCWCD 1.5 92%<br />SCBCD (In Progress)
 
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » Java in General
 
RSS feed
 
New topic
IntelliJ open source

trailboss links:

permaculture
diatomaceous earth
Sepp Holzer
rocket mass heater
raising chickens
cast iron
lawn care