문제

How to find all available interfaces defined in the class using Apache BeanUtils, MethodUtils etc. ?

public class MyClass() {
   .....
   public interface Interface1{};
   public interface Interface2{};
}
도움이 되었습니까?

해결책

I suspect you just want Class.getClasses():

Returns an array containing Class objects representing all the public classes and interfaces that are members of the class represented by this Class object. This includes public class and interface members inherited from superclasses and public class and interface members declared by the class. This method returns an array of length 0 if this Class object has no public member classes or interfaces. This method also returns an array of length 0 if this Class object represents a primitive type, an array class, or void.

So call MyClass.class.getClasses(), and then filter out non-interfaces using Class.isInterface.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top