    01: import java.io.*;
    02:
    03: public class DrawMode implements Serializable
    04: {
    05:    private DrawMode(String name) { this.name = name; }
    06:    private String name;
    07:
    08:    protected Object readResolve()
    09:    {
    10:       if (name.equals("DRAW")) return DrawMode.DRAW;
    11:       else if (name.equals("FILL")) return DrawMode.FILL;
    12:       else return null;
    13:    }
    14:
    15:
    16:    public static final DrawMode DRAW = new DrawMode("DRAW");
    17:    public static final DrawMode FILL = new DrawMode("FILL");
    18: }