org.apache.openjpa.persistence
Interface OpenJPAEnum<E extends Enum<?>>

Type Parameters:
E - the enum type that needs to be converted.
All Known Implementing Classes:
FetchMode, IsolationLevel, LRSSizeAlgorithm, ResultSetType

public interface OpenJPAEnum<E extends Enum<?>>

An interface to define conversion of a facade based enum to a kernel integer constant. Facade specific enums implement this interface to convert user specified string or integer.

Since:
2.0.0
Author:
Pinaki Poddar

Method Summary
 int convertToKernelConstant(int i)
          Convert the given integer to an equivalent kernel constant.
 int convertToKernelConstant(String s)
          Convert the given String to an equivalent kernel constant.
 int toKernelConstant()
          Convert this receiver to an equivalent kernel constant.
 

Method Detail

toKernelConstant

int toKernelConstant()
Convert this receiver to an equivalent kernel constant.


convertToKernelConstant

int convertToKernelConstant(int i)
Convert the given integer to an equivalent kernel constant. This method has a static semantics in the sense that it can be invoked on any enum instance, but the conversion is done w.r.t. all enums of the generic type.

Throws:
throw - IllegalArgumentException if no enum instance of the generic type matches the given integer.

convertToKernelConstant

int convertToKernelConstant(String s)
Convert the given String to an equivalent kernel constant. This method has a static semantics in the sense that it can be invoked on any enum instance, but the conversion is done w.r.t. all enums of the generic type.

Throws:
throw - IllegalArgumentException if no enum instance of the generic type matches the given String.


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