Top Description Fields Constructors Methods
com.sun.jna.platform

public Class EnumUtils

extends Object
Class Inheritance
Imports
java.util.HashSet, .Set, com.sun.jna.platform.win32.FlagEnum

Several helper methods to convert integer flag (sets) into enum (sets)
Author
Martin Steiger

Field Summary

Modifier and TypeField and Description
public static final int
UNINITIALIZED

Uninitialized integer flag

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static <E extends Enum<E>> E

Returns:

the enum at position idx
fromInteger
(int
the enum index
idx
,
Class<E>
the enum class
clazz
)

public static <T extends FlagEnum> Set<T>

Returns:

the representing set
setFromInteger
(int
the ORed flags
flags
,
Class<T>
the enum class
clazz
)

public static <T extends FlagEnum> int

Returns:

the flags combined into an integer
setToInteger
(Set<T>
the set to convert
set
)

public static <E extends Enum<E>> int

Returns:

the index of the enum in the enum list
toInteger
(E
the enum
val
)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

UNINITIALIZEDback to summary
public static final int UNINITIALIZED

Uninitialized integer flag

Constructor Detail

EnumUtilsback to summary
public EnumUtils()

Method Detail

fromIntegerback to summary
public static <E extends Enum<E>> E fromInteger(int idx, Class<E> clazz)
Parameters
idx:int

the enum index

clazz:Class<E>

the enum class

Returns:E

the enum at position idx

setFromIntegerback to summary
public static <T extends FlagEnum> Set<T> setFromInteger(int flags, Class<T> clazz)
Parameters
flags:int

the ORed flags

clazz:Class<T>

the enum class

Returns:Set<T>

the representing set

setToIntegerback to summary
public static <T extends FlagEnum> int setToInteger(Set<T> set)
Parameters
set:Set<T>

the set to convert

Returns:int

the flags combined into an integer

toIntegerback to summary
public static <E extends Enum<E>> int toInteger(E val)
Parameters
val:E

the enum

Returns:int

the index of the enum in the enum list