Package org.exolab.castor.mapping
Class AccessMode
java.lang.Object
org.exolab.castor.mapping.AccessMode
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable
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:
- Read only
- Shared (aka optimistic locking)
- Exclusive (aka pessimistic locking)
- DbLocked (database lock)
- Version:
- $Revision: 6907 $ $Date: 2006-04-25 15:08:23 -0600 (Tue, 25 Apr 2006) $
- Author:
- Assaf Arkin, Ralf Joachim
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AccessMode
DbLocked access.static final AccessMode
Exclusive access.static final AccessMode
Read only access.static final AccessMode
Shared access. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Clone only returns the one and only instance of this kind.int
Compares id against id of the specified object.int
compareTo
(AccessMode other) boolean
Returns if the specified object and this are one and the same instance.short
getId()
getName()
int
hashCode()
Returns the hash code of this object.protected Object
Called during deserialization.toString()
Returns the String representation of this kind.static AccessMode
valueOf
(short accessMode) static AccessMode
Returns the access mode from the name.
-
Field Details
-
ReadOnly
Read only access. Objects can be read but are not made persistent and changes to objects are not reflected in persistent storage. -
Exclusive
Exclusive access. Objects can be access by a single transaction at any given time. Equivalent to pessimistic locking. -
DbLocked
DbLocked access. Objects can be access by a single transaction at any given time, and a lock is acquired in the database.
-
-
Method Details
-
valueOf
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
-
getId
public short getId() -
getName
-
toString
Returns the String representation of this kind. -
clone
Clone only returns the one and only instance of this kind. -
equals
Returns if the specified object and this are one and the same instance. -
hashCode
public int hashCode()Returns the hash code of this object. -
compareTo
Compares id against id of the specified object. So this method is inconsistent withequals(Object)
.- Specified by:
compareTo
in interfaceComparable
- 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
-
readResolve
Called during deserialization.- Returns:
- The existing instance of the enum.
So you can use '==' like 'equals' even if you use a deserialized Enum.
-