1 42 43 package org.jfree.ui; 44 45 import java.io.ObjectStreamException ; 46 import java.io.Serializable ; 47 48 54 public final class LengthAdjustmentType implements Serializable { 55 56 57 private static final long serialVersionUID = -6097408511380545010L; 58 59 60 public static final LengthAdjustmentType NO_CHANGE 61 = new LengthAdjustmentType("NO_CHANGE"); 62 63 64 public static final LengthAdjustmentType EXPAND 65 = new LengthAdjustmentType("EXPAND"); 66 67 68 public static final LengthAdjustmentType CONTRACT 69 = new LengthAdjustmentType("CONTRACT"); 70 71 72 private String name; 73 74 79 private LengthAdjustmentType(final String name) { 80 this.name = name; 81 } 82 83 88 public String toString() { 89 return this.name; 90 } 91 92 100 public boolean equals(final Object obj) { 101 if (obj == this) { 102 return true; 103 } 104 if (!(obj instanceof LengthAdjustmentType)) { 105 return false; 106 } 107 final LengthAdjustmentType that = (LengthAdjustmentType) obj; 108 if (!this.name.equals(that.name)) { 109 return false; 110 } 111 return true; 112 } 113 114 119 public int hashCode() { 120 return this.name.hashCode(); 121 } 122 123 130 private Object readResolve() throws ObjectStreamException { 131 if (this.equals(LengthAdjustmentType.NO_CHANGE)) { 132 return LengthAdjustmentType.NO_CHANGE; 133 } 134 else if (this.equals(LengthAdjustmentType.EXPAND)) { 135 return LengthAdjustmentType.EXPAND; 136 } 137 else if (this.equals(LengthAdjustmentType.CONTRACT)) { 138 return LengthAdjustmentType.CONTRACT; 139 } 140 return null; 141 } 142 143 } 144 | Popular Tags |