Here you can find the source of extractTypes(final Class
Parameter | Description |
---|---|
E | a parameter |
type | a parameter |
public static <E extends Enum<E>> List<Class<?>> extractTypes(final Class<E> type)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.EnumSet; import java.util.List; public class Main { /**//w ww . j a v a 2s . com * A convenient method for extracting type information from all enum value for a specified enum type. * * @param <E> * @param type * @return */ public static <E extends Enum<E>> List<Class<?>> extractTypes(final Class<E> type) { final List<Class<?>> result = new ArrayList<>(); result.add(type); final EnumSet<E> mnemonicEnumSet = EnumSet.allOf(type); for (final E value : mnemonicEnumSet) { result.add(value.getClass()); } return result; } }