Here you can find the source of getInterfaces(final Class> type)
Parameter | Description |
---|---|
type | Class to check |
public final static List<Class<?>> getInterfaces(final Class<?> type)
//package com.java2s; import java.util.ArrayList; import java.util.List; public class Main { /**// w w w . ja va 2 s. c o m * Returns all interfaces of this class and its super's. If the class is an interface itself this is also returned. * * @param type Class to check * @return List of interfaces */ public final static List<Class<?>> getInterfaces(final Class<?> type) { // get all the interfaces of the class List<Class<?>> interfaces = new ArrayList<Class<?>>(); if (type.isInterface()) { interfaces.add(type); } else { Class<?> loop = type; while (!loop.equals(Object.class)) { for (Class<?> interfacez : loop.getInterfaces()) { interfaces.add(interfacez); } loop = loop.getSuperclass(); } } return interfaces; } }