org.exolab.castor.mapping
Class AccessMode

java.lang.Object
  extended by org.exolab.castor.mapping.AccessMode
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable

public class AccessMode
extends java.lang.Object
implements java.lang.Cloneable, java.lang.Comparable, java.io.Serializable

The access mode for a class. This object is used by class descriptors to specify the access mode for a class.

In persistent storage each class is defined as having one of three access modes:

Transactions typically access objects based on the specified access mode. A transaction may be requested to access any object as read only or exclusive, but may not access exclusive objects as shared.

Version:
$Revision: 1.2 $ $Date: 2005/04/17 10:29:28 $
Author:
Assaf Arkin, Ralf Joachim
See Also:
Serialized Form

Field Summary
static AccessMode DbLocked
          DbLocked access.
static AccessMode Exclusive
          Exclusive access.
static AccessMode ReadOnly
          Read only access.
static AccessMode Shared
          Shared access.
 
Method Summary
 java.lang.Object clone()
          Clone only returns the one and only instance of this kind.
 int compareTo(AccessMode other)
           
 int compareTo(java.lang.Object other)
          Compares #_kind against #_kind of the specified object.
 boolean equals(java.lang.Object other)
          Returns if the specified object and this are one and the same instance.
 short getId()
           
 java.lang.String getName()
           
 int hashCode()
          Returns the hash code of this object.
protected  java.lang.Object readResolve()
          Called during deserialization.
 java.lang.String toString()
          Returns the String representation of this kind.
static AccessMode valueOf(short accessMode)
           
static AccessMode valueOf(java.lang.String accessMode)
          Returns the access mode from the name.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ReadOnly

public static final AccessMode ReadOnly
Read only access. Objects can be read but are not made persistent and changes to objects are not reflected in persistent storage.


Shared

public static final AccessMode Shared
Shared access. Objects can be read by multiple concurrent transactions. Equivalent to optimistic locking.


Exclusive

public static final AccessMode Exclusive
Exclusive access. Objects can be access by a single transaction at any given time. Equivalent to pessimistic locking.


DbLocked

public static final AccessMode DbLocked
DbLocked access. Objects can be access by a single transaction at any given time, and a lock is acquired in the database.

Method Detail

valueOf

public static AccessMode valueOf(java.lang.String accessMode)
Returns the access mode from the name. If accessMode is null, return the default access mode (Shared). Otherwise returns the named access mode.

Parameters:
accessMode - The access mode name
Returns:
The access mode

valueOf

public static AccessMode valueOf(short accessMode)

getId

public short getId()

getName

public java.lang.String getName()

toString

public java.lang.String toString()
Returns the String representation of this kind.

Overrides:
toString in class java.lang.Object
Returns:
String representation of this kind.

clone

public java.lang.Object clone()
Clone only returns the one and only instance of this kind.

Overrides:
clone in class java.lang.Object
Returns:
The original instance.

equals

public boolean equals(java.lang.Object other)
Returns if the specified object and this are one and the same instance.

Overrides:
equals in class java.lang.Object
Parameters:
other - Object to be compared with this instance.
Returns:
true if other equals this else false.

hashCode

public int hashCode()
Returns the hash code of this object.

Overrides:
hashCode in class java.lang.Object
Returns:
Hash code of this object.

compareTo

public int compareTo(java.lang.Object other)
Compares #_kind against #_kind of the specified object. So this method is inconsistent with equals(java.lang.Object).

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
other - Object to be compared with this instance.
Returns:
A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

compareTo

public int compareTo(AccessMode other)

readResolve

protected java.lang.Object readResolve()
Called during deserialization.

Returns:
The existing instance of the enum.
So you can use '==' like 'equals' even if you use a deserialized Enum.


Intalio Inc. (C) 1999-2004. All rights reserved http://www.intalio.com