[jsword-devel] Migration to Java 5
DM Smith
dmsmith555 at yahoo.com
Fri Mar 3 05:36:45 MST 2006
I have just migrated our "typesafe enums" to Java 5 enums.
For an overview see:
http://java.sun.com/j2se/1.5.0/docs/guide/language/enums.html
Basically our typesafe enums had some or all of the following features:
Serializable
Comparable, with deterministic ordering
Canonical objects (hashCode, toString, equals, ...)
a name that may differ from the spelling of the enum constant
the ability to derive an enum from
its name or
the string representation of its constant name or
the ordinal position in a global ordering
Static state
Dynamic global state
Behavior
Java 5 enums has most of this. We needed to provide a lookup for its
name and its ordinal position.
It gets rid of a bunch of code.
More information about the jsword-devel
mailing list