Here you can find the source of castEnum(Enum> enum_param)
Parameter | Description |
---|---|
enum_param | the enum to be casted |
@SuppressWarnings("unchecked") public static <T extends Enum<?>> T castEnum(Enum<?> enum_param)
//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; } }