Tabnine Logo
Class.getInterfaces
Code IndexAdd Tabnine to your IDE (free)

How to use
getInterfaces
method
in
java.lang.Class

Best Java code snippets using java.lang.Class.getInterfaces (Showing top 20 results out of 24,606)

origin: libgdx/libgdx

static public Class[] getInterfaces(Class c) {
  return c.getInterfaces();
}
origin: spring-projects/spring-framework

@Override
public String[] getInterfaceNames() {
  Class<?>[] ifcs = this.introspectedClass.getInterfaces();
  String[] ifcNames = new String[ifcs.length];
  for (int i = 0; i < ifcs.length; i++) {
    ifcNames[i] = ifcs[i].getName();
  }
  return ifcNames;
}
origin: google/guava

@Override
Iterable<? extends Class<?>> getInterfaces(Class<?> type) {
 return Arrays.asList(type.getInterfaces());
}
origin: google/guava

 private static boolean isProxyOfSameInterfaces(Object arg, Class<?> proxyClass) {
  return proxyClass.isInstance(arg)
    // Equal proxy instances should mostly be instance of proxyClass
    // Under some edge cases (such as the proxy of JDK types serialized and then deserialized)
    // the proxy type may not be the same.
    // We first check isProxyClass() so that the common case of comparing with non-proxy objects
    // is efficient.
    || (Proxy.isProxyClass(arg.getClass())
      && Arrays.equals(arg.getClass().getInterfaces(), proxyClass.getInterfaces()));
 }
}
origin: square/retrofit

static <T> void validateServiceInterface(Class<T> service) {
 if (!service.isInterface()) {
  throw new IllegalArgumentException("API declarations must be interfaces.");
 }
 // Prevent API interfaces from extending other interfaces. This not only avoids a bug in
 // Android (http://b.android.com/58753) but it forces composition of API declarations which is
 // the recommended pattern.
 if (service.getInterfaces().length > 0) {
  throw new IllegalArgumentException("API interfaces must not extend other interfaces.");
 }
}
origin: spring-projects/spring-framework

@Nullable
private static List<Method> findConcreteMethodsOnInterfaces(Class<?> clazz) {
  List<Method> result = null;
  for (Class<?> ifc : clazz.getInterfaces()) {
    for (Method ifcMethod : ifc.getMethods()) {
      if (!Modifier.isAbstract(ifcMethod.getModifiers())) {
        if (result == null) {
          result = new ArrayList<>();
        }
        result.add(ifcMethod);
      }
    }
  }
  return result;
}
origin: spring-projects/spring-framework

public static List addAllInterfaces(Class type, List list) {
  Class superclass = type.getSuperclass();
  if (superclass != null) {
    list.addAll(Arrays.asList(type.getInterfaces()));
    addAllInterfaces(superclass, list);
  }
  return list;
}
origin: spring-projects/spring-framework

/**
 * Determine whether the given interface is just a container callback and
 * therefore not to be considered as a reasonable proxy interface.
 * <p>If no reasonable proxy interface is found for a given bean, it will get
 * proxied with its full target class, assuming that as the user's intention.
 * @param ifc the interface to check
 * @return whether the given interface is just a container callback
 */
protected boolean isConfigurationCallbackInterface(Class<?> ifc) {
  return (InitializingBean.class == ifc || DisposableBean.class == ifc || Closeable.class == ifc ||
      AutoCloseable.class == ifc || ObjectUtils.containsElement(ifc.getInterfaces(), Aware.class));
}
origin: spring-projects/spring-framework

private void addInterfacesToClassHierarchy(Class<?> type, boolean asArray,
    List<Class<?>> hierarchy, Set<Class<?>> visited) {
  for (Class<?> implementedInterface : type.getInterfaces()) {
    addToClassHierarchy(hierarchy.size(), implementedInterface, asArray, hierarchy, visited);
  }
}
origin: spring-projects/spring-framework

public Type[] getInterfaces() {
  return TypeUtils.getTypes(clazz.getInterfaces());
}
public int getModifiers() {
origin: greenrobot/EventBus

/** Recurses through super interfaces. */
static void addInterfaces(List<Class<?>> eventTypes, Class<?>[] interfaces) {
  for (Class<?> interfaceClass : interfaces) {
    if (!eventTypes.contains(interfaceClass)) {
      eventTypes.add(interfaceClass);
      addInterfaces(eventTypes, interfaceClass.getInterfaces());
    }
  }
}
origin: spring-projects/spring-framework

private List<Annotation[][]> getInterfaceParameterAnnotations() {
  List<Annotation[][]> parameterAnnotations = this.interfaceParameterAnnotations;
  if (parameterAnnotations == null) {
    parameterAnnotations = new ArrayList<>();
    for (Class<?> ifc : this.method.getDeclaringClass().getInterfaces()) {
      for (Method candidate : ifc.getMethods()) {
        if (isOverrideFor(candidate)) {
          parameterAnnotations.add(candidate.getParameterAnnotations());
        }
      }
    }
    this.interfaceParameterAnnotations = parameterAnnotations;
  }
  return parameterAnnotations;
}
origin: spring-projects/spring-framework

public static List addAllMethods(final Class type, final List list) {
  if (type == Object.class) {
    list.addAll(OBJECT_METHODS);
  }
  else
    list.addAll(java.util.Arrays.asList(type.getDeclaredMethods()));
  Class superclass = type.getSuperclass();
  if (superclass != null) {
    addAllMethods(superclass, list);
  }
  Class[] interfaces = type.getInterfaces();
  for (int i = 0; i < interfaces.length; i++) {
    addAllMethods(interfaces[i], list);
  }
  return list;
}
origin: spring-projects/spring-framework

@Nullable
private static Method searchInterfaces(Class<?>[] interfaces, Method bridgeMethod) {
  for (Class<?> ifc : interfaces) {
    Method method = searchForMatch(ifc, bridgeMethod);
    if (method != null && !method.isBridge()) {
      return method;
    }
    else {
      method = searchInterfaces(ifc.getInterfaces(), bridgeMethod);
      if (method != null) {
        return method;
      }
    }
  }
  return null;
}
origin: jenkinsci/jenkins

private static boolean isSuperTypesStaplerRelevant(@Nonnull Class<?> clazz) {
  Class<?> superclass = clazz.getSuperclass();
  if (superclass != null && isStaplerRelevantCached(superclass)) {
    return true;
  }
  for (Class<?> interfaceClass : clazz.getInterfaces()) {
    if (isStaplerRelevantCached(interfaceClass)) {
      return true;
    }
  }
  return false;
}
origin: spring-projects/spring-framework

public Set<SourceClass> getInterfaces() throws IOException {
  Set<SourceClass> result = new LinkedHashSet<>();
  if (this.source instanceof Class) {
    Class<?> sourceClass = (Class<?>) this.source;
    for (Class<?> ifcClass : sourceClass.getInterfaces()) {
      result.add(asSourceClass(ifcClass));
    }
  }
  else {
    for (String className : this.metadata.getInterfaceNames()) {
      result.add(asSourceClass(className));
    }
  }
  return result;
}
origin: org.mockito/mockito-core

private void addInterfaces(Set<Class<?>> types, Class<?>[] interfaces) {
  for (Class<?> type : interfaces) {
    if (mocked.add(type)) {
      types.add(type);
      addInterfaces(types, type.getInterfaces());
    }
  }
}
origin: spring-projects/spring-framework

private void introspectInterfaces(Class<?> beanClass, Class<?> currClass) throws IntrospectionException {
  for (Class<?> ifc : currClass.getInterfaces()) {
    if (!ClassUtils.isJavaLanguageInterface(ifc)) {
      for (PropertyDescriptor pd : getBeanInfo(ifc).getPropertyDescriptors()) {
        PropertyDescriptor existingPd = this.propertyDescriptorCache.get(pd.getName());
        if (existingPd == null ||
            (existingPd.getReadMethod() == null && pd.getReadMethod() != null)) {
          // GenericTypeAwarePropertyDescriptor leniently resolves a set* write method
          // against a declared read method, so we prefer read method descriptors here.
          pd = buildGenericTypeAwarePropertyDescriptor(beanClass, pd);
          this.propertyDescriptorCache.put(pd.getName(), pd);
        }
      }
      introspectInterfaces(ifc, ifc);
    }
  }
}
origin: google/guava

private static ImmutableSet<TypeToken<?>> arrayInterfaces() {
 ImmutableSet.Builder<TypeToken<?>> builder = ImmutableSet.builder();
 for (Class<?> interfaceType : Object[].class.getInterfaces()) {
  builder.add(TypeToken.of(interfaceType));
 }
 return builder.build();
}
origin: google/guava

public <T, T1 extends T> void testAssignableGenericArrayToClass() {
 assertTrue(TypeToken.of(Object[].class.getSuperclass()).isSupertypeOf(new TypeToken<T[]>() {}));
 for (Class<?> interfaceType : Object[].class.getInterfaces()) {
  assertTrue(TypeToken.of(interfaceType).isSupertypeOf(new TypeToken<T[]>() {}));
 }
 assertTrue(TypeToken.of(Object.class).isSupertypeOf(new TypeToken<T[]>() {}));
 assertFalse(TypeToken.of(String.class).isSupertypeOf(new TypeToken<T[]>() {}));
}
java.langClassgetInterfaces

Javadoc

Returns an array of Class objects that match the interfaces in the implements declaration of the class represented by this Class. The order of the elements in the array is identical to the order in the original class declaration. If the class does not implement any interfaces, an empty array is returned.

Popular methods of Class

  • getName
    Returns the name of the class represented by this Class. For a description of the format which is us
  • getSimpleName
  • getClassLoader
  • isAssignableFrom
    Determines if the class or interface represented by this Class object is either the same as, or is a
  • forName
    Returns the Class object associated with the class or interface with the given string name, using th
  • newInstance
    Returns a new instance of the class represented by this Class, created by invoking the default (that
  • getMethod
    Returns a Method object that reflects the specified public member method of the class or interface r
  • getResourceAsStream
  • getSuperclass
    Returns the Class representing the superclass of the entity (class, interface, primitive type or voi
  • getConstructor
  • cast
    Casts an object to the class or interface represented by this Class object.
  • isInstance
  • cast,
  • isInstance,
  • getCanonicalName,
  • getDeclaredField,
  • isArray,
  • getAnnotation,
  • getDeclaredFields,
  • getResource,
  • getDeclaredMethod,
  • getMethods

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • notifyDataSetChanged (ArrayAdapter)
  • getSharedPreferences (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Socket (java.net)
    Provides a client-side TCP socket.
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • JFileChooser (javax.swing)
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now