org.apache.openjpa.persistence
Class MixedLockLevelsHelper

java.lang.Object
  extended by org.apache.openjpa.persistence.MixedLockLevelsHelper
All Implemented Interfaces:
HintValueConverter

public class MixedLockLevelsHelper
extends Object
implements HintValueConverter

Helper methods translate between JPA-defined lock mode and OpenJPA internal lock levels.

Since:
2.0.0
Author:
Albert Lee

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.openjpa.persistence.HintValueConverter
HintValueConverter.EnumToInteger, HintValueConverter.OpenJPAEnumToInteger, HintValueConverter.StringToBoolean, HintValueConverter.StringToInteger
 
Constructor Summary
MixedLockLevelsHelper()
           
 
Method Summary
 boolean canConvert(Class<?> type)
          Affirm if this receiver can convert the value of the given type.
 Object convert(Object original)
          Convert the user-specified value to a kernel consumable value.
static LockModeType fromLockLevel(int level)
          Translates internal lock level to javax.persistence LockModeType.
static int toLockLevel(int mode)
           
static int toLockLevel(LockModeType mode)
          Translates javax.persistence LockModeType to internal lock level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MixedLockLevelsHelper

public MixedLockLevelsHelper()
Method Detail

toLockLevel

public static int toLockLevel(LockModeType mode)
Translates javax.persistence LockModeType to internal lock level.


toLockLevel

public static int toLockLevel(int mode)

fromLockLevel

public static LockModeType fromLockLevel(int level)
Translates internal lock level to javax.persistence LockModeType.


canConvert

public boolean canConvert(Class<?> type)
Description copied from interface: HintValueConverter
Affirm if this receiver can convert the value of the given type.

Specified by:
canConvert in interface HintValueConverter

convert

public Object convert(Object original)
Description copied from interface: HintValueConverter
Convert the user-specified value to a kernel consumable value.

Specified by:
convert in interface HintValueConverter
Parameters:
original - the user-specified value
Returns:
an equivalent value consumable by a kernel construct.


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.