code: private static Set<Class<?>> getInterfaces(Class type, Set<Class<?>> interfaces) {
  
      if (type.getSuperclass() != null) {
        getInterfaces(type.getSuperclass(), interfaces);
      }
  
      for (Class<?> implementedType : type.getInterfaces()) {
        if (!interfaces.contains(implementedType)) {
          interfaces.add(implementedType);
          getInterfaces(implementedType, interfaces);
        }
      }
  
      return interfaces;
    }
docs: Determines all the interfaces implemented by the given {@link Class} type.
  
  This method performs a deep analysis of all the interfaces implemented by the given {@link Class} type
  along with interfaces implemented by the {@link Class Class's} {@link Class superclass},
  up the {@link Class} hierarchy until the {@link Object} class is reached.
  
  @param type {@link Class} to evaluate.
  @param interfaces {@link Set} containing all the {@link Class interfaces} implemented by
  the given {@link Class} type.
  @return all interfaces implemented by the given {@link Class} and its superclass.
  Returns an empty {@link Set} if the given {@link Class} does not implement any interfaces.
  @see java.lang.Class