Class EnumUtil

java.lang.Object
com.smartgwt.client.util.EnumUtil

public class EnumUtil extends Object
Utils for manipulate with a Enum.
  • Constructor Details

    • EnumUtil

      public EnumUtil()
  • Method Details

    • getEnum

      public static <TYPE extends ValueEnum> TYPE getEnum(TYPE[] enums, String value)
      Get a enum item by value.
      Parameters:
      enums - - enum items
      value - - enum value
      Returns:
      enum item
      See Also:
    • getEnums

      public static <TYPE extends ValueEnum> TYPE[] getEnums(TYPE[] enums, String[] values, TYPE[] result)
      Get a enum items by values.

      The java 1.6 does not support a code " {@code (TYPE[]) new Object[values.length];". Also, the GWT does not support a reflection api ( {@link java.lang.reflect.Array#newInstance}). So you need to pass an array argument to store the result. @param enums - enum items @param values - enum values @param result - array to store the result @return enum items

    • getEnums

      public static <TYPE extends ValueEnum> ValueEnum[] getEnums(TYPE[] enums, String[] values)
      Get a enum items by values.

      This method is not compatible with the java 1.6.

      Parameters:
      enums - - enum items
      values - - enum values
      Returns:
      enum items
      See Also: