Skip navigation links
JNA API 5.6.0
com.sun.jna.platform

Class EnumUtils



  • public class EnumUtils
    extends java.lang.Object
    Several helper methods to convert integer flag (sets) into enum (sets)
    Author:
    Martin Steiger
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int UNINITIALIZED
      Uninitialized integer flag
    • Constructor Summary

      Constructors 
      Constructor and Description
      EnumUtils() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static <E extends java.lang.Enum<E>>
      E
      fromInteger(int idx, java.lang.Class<E> clazz) 
      static <T extends FlagEnum>
      java.util.Set<T>
      setFromInteger(int flags, java.lang.Class<T> clazz) 
      static <T extends FlagEnum>
      int
      setToInteger(java.util.Set<T> set) 
      static <E extends java.lang.Enum<E>>
      int
      toInteger(E val) 
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • UNINITIALIZED

        public static final int UNINITIALIZED
        Uninitialized integer flag
        See Also:
        Constant Field Values
    • Constructor Detail

      • EnumUtils

        public EnumUtils()
    • Method Detail

      • toInteger

        public static <E extends java.lang.Enum<E>> int toInteger(E val)
        Parameters:
        val - the enum
        Returns:
        the index of the enum in the enum list
      • fromInteger

        public static <E extends java.lang.Enum<E>> E fromInteger(int idx,
                                                                  java.lang.Class<E> clazz)
        Parameters:
        idx - the enum index
        clazz - the enum class
        Returns:
        the enum at position idx
      • setFromInteger

        public static <T extends FlagEnum> java.util.Set<T> setFromInteger(int flags,
                                                                           java.lang.Class<T> clazz)
        Parameters:
        flags - the ORed flags
        clazz - the enum class
        Returns:
        the representing set
      • setToInteger

        public static <T extends FlagEnum> int setToInteger(java.util.Set<T> set)
        Parameters:
        set - the set to convert
        Returns:
        the flags combined into an integer
JNA API 5.6.0

Copyright © 2007-2018 Timothy Wall. All Rights Reserved.