Java Reflection Interface Get getImplementedInterfaces(Class clazz)

Here you can find the source of getImplementedInterfaces(Class clazz)

Description

Returns the list of interfaces implemented by the class clazz.

License

Open Source License

Parameter

Parameter Description
clazz a parameter

Declaration

private static List<String> getImplementedInterfaces(Class clazz) 

Method Source Code

//package com.java2s;
/**//ww w  . ja v a  2  s .  co m
 * Copyright (c) 2013 Obeo.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     Obeo - initial API and implementation
 * 
 */

import java.util.ArrayList;

import java.util.List;

public class Main {
    /**
     * Returns the list of interfaces implemented by the class
     * <code>clazz</code>.
     * 
     * @param clazz
     * @return
     */
    private static List<String> getImplementedInterfaces(Class clazz) {
        List<String> list = new ArrayList();
        Class[] classes = clazz.getInterfaces();
        for (Class c : classes) {
            list.add(c.getCanonicalName());
            list.addAll(getImplementedInterfaces(c));
        }
        return list;
    }
}

Related

  1. getAllInterfacesForClass(Class clazz)
  2. getAllInterfacesNames(Class aClass)
  3. getClassHierarchy(Class c, boolean includeInterfaces)
  4. getDeclaredInterfaces(Class claz, Class... assignableClasses)
  5. getImplementedInterfaceParents(Class clazz, Set classesResult)
  6. getImplementedInterfaces(Class cl)
  7. getInterfaceInstance(Class interfaceType)
  8. getInterfaceNames(Class c)
  9. getInterfaces(Class clazz)