Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
> I have a class that employs the typesafe java enum pattern described in eckel's book "thinking in java" p. 276. > Here is the code: > public final class AvailabilityStatus { > private AvailabilityStatus(String name) { > public String toString() { > public static final AvailabilityStatus > } > > Does anyone know how to do this is a clean way without all the string comparisons? No. You have to do the string compares somewhere, just as you Extend the enum pattern with public static AvailabilityStatus and have your constructor put all new instances in a static Replies: |
Sponsored Links
|