Package adams.core

Class EnumHelper


  • public class EnumHelper
    extends Object
    Helper class for enum-related operations.
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Field Detail

      • METHOD_VALUES

        public static final String METHOD_VALUES
        the name of the static method for returning all values of an enum.
        See Also:
        Constant Field Values
    • Constructor Detail

      • EnumHelper

        public EnumHelper()
    • Method Detail

      • getValues

        public static Object[] getValues​(Object obj)
        Gets all the values of the num.
        Parameters:
        obj - the enm object to get the values from
        Returns:
        an array of string tags.
      • getValues

        public static Object[] getValues​(Class cls)
        Gets all the values of the num.
        Parameters:
        cls - the enm class to get the values from
        Returns:
        an array of string tags.
      • determineClass

        public static Class determineClass​(Object obj)
        Determines the base class.
        Parameters:
        obj - the object to inspect
        Returns:
        the determined class
      • parse

        public static Object parse​(Class cls,
                                   String s)
        Parses the given enum string.
        Parameters:
        cls - the enum class
        s - the string to parse
        Returns:
        the parsed enum, null in case of an error