KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > engine > Status


1 //$Id: Status.java,v 1.3 2005/06/15 04:04:18 oneovthafew Exp $
2
package org.hibernate.engine;
3
4 import java.io.Serializable JavaDoc;
5 import java.io.ObjectStreamException JavaDoc;
6 import java.io.InvalidObjectException JavaDoc;
7
8 /**
9  * Represents the status of an entity with respect to
10  * this session. These statuses are for internal
11  * book-keeping only and are not intended to represent
12  * any notion that is visible to the _application_.
13  */

14 public final class Status implements Serializable JavaDoc {
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 JavaDoc name;
24
25     private Status(String JavaDoc name) {
26         this.name = name;
27     }
28
29     public String JavaDoc toString() {
30         return name;
31     }
32
33     private Object JavaDoc readResolve() throws ObjectStreamException JavaDoc {
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 JavaDoc( "invalid Status" );
41     }
42
43 }
44
Popular Tags