org.exolab.castor.mapping

Class AccessMode

public class AccessMode extends Object implements Cloneable, Comparable, 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: 6216 $ $Date: 2006-04-25 15:08:23 -0600 (Tue, 25 Apr 2006) $

Author: Assaf Arkin Ralf Joachim

Field Summary
static AccessModeDbLocked
DbLocked access.
static AccessModeExclusive
Exclusive access.
static AccessModeReadOnly
Read only access.
static AccessModeShared
Shared access.
Method Summary
Objectclone()
Clone only returns the one and only instance of this kind.
intcompareTo(Object other)
Compares id against id of the specified object.
intcompareTo(AccessMode other)
booleanequals(Object other)
Returns if the specified object and this are one and the same instance.
shortgetId()
StringgetName()
inthashCode()
Returns the hash code of this object.
protected ObjectreadResolve()
Called during deserialization.
StringtoString()
Returns the String representation of this kind.
static AccessModevalueOf(String accessMode)
Returns the access mode from the name.
static AccessModevalueOf(short accessMode)

Field Detail

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.

Exclusive

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

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.

Method Detail

clone

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

Returns: The original instance.

compareTo

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

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)

equals

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

Parameters: other Object to be compared with this instance.

Returns: true if other equals this else false.

getId

public short getId()

getName

public String getName()

hashCode

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

Returns: Hash code of this object.

readResolve

protected 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.

toString

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

Returns: String representation of this kind.

valueOf

public static AccessMode valueOf(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)
Intalio Inc. (C) 1999-2006. All rights reserved http://www.intalio.com