enum as Factory?

Does anyone know why public enum MyRestrictedSetOfObjects extends SomeOtherClass {...}is forbiden?I would like to have a compiler checked "factory", setup with predefined objects.
[221 byte] By [c.ayaa] at [2007-10-2 4:26:00]
# 1
Java doesn't offer this possibility nativelyeclipse (3.1.1 at least) doescheck Window => Preferences => Java => Compiler options
Torajiroua at 2007-7-15 23:54:09 > top of Java-index,Other Topics,Patterns & OO Design...
# 2
btw, it doesn't work the way you wrote in your postyou just use a switch on an enum and eclipse warns you if you didn't put all the cases
Torajiroua at 2007-7-15 23:54:09 > top of Java-index,Other Topics,Patterns & OO Design...
# 3

Actually I wanted something like:

public class AppPaperTypes extends PPDPaper {

public static AppPaperTypes PLAIN_A4 = new AppPaperTypes("plain", PageFormat.PORTRAIT);

public static AppPaperTypes PLAIN_A4_L = new AppPaperTypes("plain", PageFormat.LANDSCAPE);

public static AppPaperTypes LETTER_HEAD = new AppPaperTypes("LETTER_HEAD", PageFormat.PORTRAIT);

public static AppPaperTypes APP_CERTIFICATE = new AppPaperTypes("CERTIFICATE", PageFormat.PORTRAIT);

private AppPaperType(String media, int orientation) {

super("*PPDTAG", media, 595, 848, orientation);

}

}

but with the possibility of having this "pattern" casted as enum. The nice to have here is the possibility of using the super type for free (i.e. all its methods, etc) instead of adding more verbosity to an already verbose language.

So, why is this forbiden?

c.ayaa at 2007-7-15 23:54:09 > top of Java-index,Other Topics,Patterns & OO Design...