1 42 43 package org.jfree.ui; 44 45 import java.io.ObjectStreamException ; 46 import java.io.Serializable ; 47 48 53 public final class Layer implements Serializable { 54 55 56 private static final long serialVersionUID = -1470104570733183430L; 57 58 59 public static final Layer FOREGROUND = new Layer("Layer.FOREGROUND"); 60 61 62 public static final Layer BACKGROUND = new Layer("Layer.BACKGROUND"); 63 64 65 private String name; 66 67 72 private Layer(final String name) { 73 this.name = name; 74 } 75 76 81 public String toString() { 82 return this.name; 83 } 84 85 93 public boolean equals(final Object o) { 94 95 if (this == o) { 96 return true; 97 } 98 if (!(o instanceof Layer)) { 99 return false; 100 } 101 102 final Layer layer = (Layer) o; 103 if (!this.name.equals(layer.name)) { 104 return false; 105 } 106 107 return true; 108 109 } 110 111 116 public int hashCode() { 117 return this.name.hashCode(); 118 } 119 120 127 private Object readResolve() throws ObjectStreamException { 128 Layer result = null; 129 if (this.equals(Layer.FOREGROUND)) { 130 result = Layer.FOREGROUND; 131 } 132 else if (this.equals(Layer.BACKGROUND)) { 133 result = Layer.BACKGROUND; 134 } 135 return result; 136 } 137 138 } 139 140 | Popular Tags |