1 package org.hibernate.engine; 3 4 import java.io.Serializable ; 5 import java.io.ObjectStreamException ; 6 import java.io.InvalidObjectException ; 7 8 14 public final class Status implements Serializable { 15 16 public static final Status MANAGED = new Status( "MANAGED" ); 17 public static final Status READ_ONLY = new Status( "READ_ONLY" ); 18 public static final Status DELETED = new Status( "DELETED" ); 19 public static final Status GONE = new Status( "GONE" ); 20 public static final Status LOADING = new Status( "LOADING" ); 21 public static final Status SAVING = new Status( "SAVING" ); 22 23 private String name; 24 25 private Status(String name) { 26 this.name = name; 27 } 28 29 public String toString() { 30 return name; 31 } 32 33 private Object readResolve() throws ObjectStreamException { 34 if ( name.equals(MANAGED.name) ) return MANAGED; 35 if ( name.equals(READ_ONLY.name) ) return READ_ONLY; 36 if ( name.equals(DELETED.name) ) return DELETED; 37 if ( name.equals(GONE.name) ) return GONE; 38 if ( name.equals(LOADING.name) ) return LOADING; 39 if ( name.equals(SAVING.name) ) return SAVING; 40 throw new InvalidObjectException ( "invalid Status" ); 41 } 42 43 } 44 | Popular Tags |