Java Object Type Case castEnum(Enum enum_param)

Here you can find the source of castEnum(Enum enum_param)

Description

This method just is a workaround such that maven can compile and do not proclaim when an enum is directly casted!

License

Open Source License

Parameter

Parameter Description
enum_param the enum to be casted

Return

the enum casted to T

Declaration

@SuppressWarnings("unchecked")
public static <T extends Enum<?>> T castEnum(Enum<?> enum_param) 

Method Source Code

//package com.java2s;

public class Main {
    /**//  w ww  .j av a 2  s  . c om
     * This method just is a workaround such that maven can compile and do not proclaim when an enum is directly casted!
     *
     * @param enum_param the enum to be casted
     * @return the enum casted to T
     */
    @SuppressWarnings("unchecked")
    public static <T extends Enum<?>> T castEnum(Enum<?> enum_param) {
        return (T) enum_param;
    }
}

Related

  1. castArray(Object[] array, T[] targetArray)
  2. castAs(Class clazz, Object obj)
  3. castAsDoubleArray(int[] input)
  4. castClass(Class aClass)
  5. castClone(U obj, T superClone)
  6. castEnum(T from, U[] to)
  7. castForRegex(String textContent)
  8. castingNum(double n)
  9. castingUtil(String value, Class classCasting)